package pkg2;
import java.util.Scanner;
import java.io.File;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the path: ");
String str = sc.nextLine();
File f = new File(str);
File total[] = f.listFiles();
System.out.println("Total File: "+total.length);
System.out.println("All file Location: ");
for(int i =0;i<total.length;i++)
{
System.out.println(total[i].getAbsoluteFile());
}
}
}
Output
Enter the path:
(your file location/path)
Total File:
(your files in the path)
All File Location:
(your all file locaions)
Add your comment