Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #$1 is parameter one, archive file path
  4. #$2 is parameter two, image source file path
  5.  
  6. #tests if photo archive folder exists, if not, it gets created
  7. if test -d $1
  8. then echo "
  9. Photo Archive Status: Archive exists";
  10. else mkdir $1
  11. echo "
  12. Archive did not exist, therefore archive was created";
  13. fi
  14.  
  15. #tests if the image source directory exists, if not, window closes
  16. if test -d $2
  17. then echo "Images Source Directory Status: Image source exists";
  18. else echo "Image source does not exist, window will not terminate"
  19. exit;
  20. fi
  21.  
  22. #find to display all the filenames with correct naming convention and format
  23. #due to potentially thousands of files, this isn't recommended for larger projects
  24. echo "
  25. List of all suitable files found:
  26. "
  27. find $2 -name "IMG_[0-9][0-9][0-9][0-9].JPG" -exec echo {} \;
  28.  
  29. #copies all image files (with unique filenames) over to the archive
  30. find $2 -name "IMG_[0-9][0-9][0-9][0-9].JPG" -exec cp {} $1 \;
  31. echo "
  32. All unique images archived in $1";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement