Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. -src
  2. -images
  3. -*.jpg
  4. -stock
  5. -*.java
  6. -images (exact copy of -images)
  7.  
  8. -jar
  9. -images
  10. -*.jpg
  11. -stock
  12. -*.java
  13. -images (folder is created but files don't get copied)
  14.  
  15. File imagesCopy = new File("images");
  16. File imagesOrg = new File(URLDecoder.decode(getClass().getResource("/images").getPath()));
  17.  
  18. if (!imagesCopy.exists()) {
  19. imagesCopy.mkdir();
  20. for(final File child : imagesOrg.listFiles()) {
  21. try{
  22. Files.copy(child.toPath(), Paths.get(imagesCopy.getAbsolutePath()+"/"+child.getName()), REPLACE_EXISTING);
  23. }catch(Exception e){
  24. System.out.println(e);
  25. }
  26. }
  27. }
  28.  
  29. File imagesOrg = new File(URLDecoder.decode(getClass().getResource("/images").getPath()));
  30.  
  31. D:Codebuildclassesimages
  32.  
  33. D:Codedistfile:D:Codedistegz.jar!images
  34.  
  35. D:Codedistegz.jar!images
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement