You are on page 1of 1

1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.io.*;
public class Archivo
{
public static void main (String args[])
{
File f;

try {
f = new File (args[0]);
System.out.println ("Name: "+f.getName());
System.out.println ("Parent: "+f.getParent());
System.out.println ("Path: "+f.getPath());
System.out.println ("AbsolutePath: "+f.getAbsolutePath());
if (f.exists ()) {
if (f.isFile ()){
System.out.println ("El archivo ya existe");
System.out.println ("Long. del archivo: "+f.length());
}
else
System.out.println ("El directorio ya existe");
}
else {
System.out.println ("El nombre no se encuentra");
if (!f.isFile())
f.mkdir ();
}
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println ("Uso: java Archivo archivo/directorio");
}
}
}

You might also like