Browse Source

Merge pull request 'root' (#1) from root into master

Reviewed-on: #1
master
kevin 2 years ago
parent
commit
c22155cf8c
3 changed files with 19 additions and 6 deletions
  1. +12
    -0
      README.md
  2. BIN
      bin/dam/daw/com/es/HolaFicheroPermisos.class
  3. +7
    -6
      src/dam/daw/com/es/HolaFicheroPermisos.java

+ 12
- 0
README.md View File

@ -0,0 +1,12 @@
Explicacion de la actividad HolaficheroPermisos
Lo primero que he hecho es buscar un file/archivo.txt
Luego he hecho que el programa muestre si en este archivo podemos ejecutar/leer/escribir/ultima vez escrito/lo que pesa el archivo/Nombre del archivo
```
Executable Readable Writable lastimewrite Lengh Name
---------- --------- --------- ------------- ------ -----
true true true Tue Sep 20 16:52:59 CEST 2022 0 CreoFicheroWindows.txt

BIN
bin/dam/daw/com/es/HolaFicheroPermisos.class View File


+ 7
- 6
src/dam/daw/com/es/HolaFicheroPermisos.java View File

@ -8,18 +8,19 @@ public class HolaFicheroPermisos {
public static void main(String[] args) throws IOException public static void main(String[] args) throws IOException
{ {
// creating a file instance
File file = new File("C:\\Users\\kevin\\Documents\\workspace-spring-tool-suite-4-4.16.0.RELEASE\\CreoFicheroWindows.txt");
// crear el file
File file1 = new File("C:\\Users\\kevin\\Documents\\workspace-spring-tool-suite-4-4.16.0.RELEASE\\CreoFicheroWindows.txt");
// check if the file exists
boolean exists = file.exists();
// mira si existe
boolean exists = file1.exists();
if(exists == true) if(exists == true)
{ {
// printing the permissions associated with the file // printing the permissions associated with the file
System.out.println("Executable Readable Writable lastimewrite Lengh Name"); System.out.println("Executable Readable Writable lastimewrite Lengh Name");
System.out.println("---------- --------- --------- ------------- ------ -----"); System.out.println("---------- --------- --------- ------------- ------ -----");
System.out.println(file.canExecute() + " " + file.canRead() + " " + file.canWrite() +" "+ new Date(file.lastModified())+ " "+ file.length()+" "+ file.getName());
System.out.println(file1.canExecute() + " " + file1.canRead() + " " + file1.canWrite() +" "+ new Date(file1.lastModified())+ " "+ file1.length()+" "+ file1.getName());
} }
else else
{ {


Loading…
Cancel
Save