diff --git a/bin/dam/daw/com/es/HolaFichero.class b/bin/dam/daw/com/es/HolaFichero.class index cbc21d0..521c9ae 100644 Binary files a/bin/dam/daw/com/es/HolaFichero.class and b/bin/dam/daw/com/es/HolaFichero.class differ diff --git a/src/dam/daw/com/es/HolaFichero.java b/src/dam/daw/com/es/HolaFichero.java index 265b794..20b216b 100644 --- a/src/dam/daw/com/es/HolaFichero.java +++ b/src/dam/daw/com/es/HolaFichero.java @@ -1,5 +1,8 @@ package dam.daw.com.es; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.io.File; import java.io.IOException; public class HolaFichero { @@ -33,11 +36,28 @@ public class HolaFichero { public static void CreoFicheroWindows() throws IOException { System.out.println("Creando fichero en Windows ..."); - File fwindows = new File("C:\\Users\\kevin\\Documents\\CreoFicheroWindows.txt"); + File fwindows = new File("C:\\Users\\kevin\\Documents\\workspace-spring-tool-suite-4-4.16.0.RELEASE\\CreoFicheroWindows.txt"); if (!fwindows.exists()) { fwindows.createNewFile(); } + System.out.println("Fichero creado en Windows."); + + + // check if the fwindows exists + boolean exists = fwindows.exists(); + if(exists == true) + { + // printing the permissions associated with the file + System.out.println("Executable: " + fwindows.canExecute()); + System.out.println("Readable: " + fwindows.canRead()); + System.out.println("Writable: "+ fwindows.canWrite()); + } + else + { + System.out.println("File not found."); + } + } public void CreoFicheroLinux() throws IOException {