Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import java.io.*;
  2. //Ova e rekurzija
  3. public class solution {
  4. public static void main(String[] args) {
  5. File folder = new File("C:\\Users\\xxx\\Desktop\\UTP");
  6. showFiles(folder);
  7. }
  8.  
  9. public static void showFiles (File folder)
  10. {
  11. File [] listOfFiles = folder.listFiles();
  12. for(int i=0;i<listOfFiles.length;i++)
  13. {
  14. if(listOfFiles[i].isDirectory())
  15. {
  16. System.out.println(listOfFiles[i].toString());
  17. showFiles(listOfFiles[i]);
  18. }
  19. else
  20. {
  21. System.out.println(listOfFiles[i].toString());
  22. }
  23. }
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement