Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #$1 is parameter one, archive file path
- #$2 is parameter two, image source file path
- #tests if photo archive folder exists, if not, it gets created
- if test -d $1
- then echo "
- Photo Archive Status: Archive exists";
- else mkdir $1
- echo "
- Archive did not exist, therefore archive was created";
- fi
- #tests if the image source directory exists, if not, window closes
- if test -d $2
- then echo "Images Source Directory Status: Image source exists";
- else echo "Image source does not exist, window will not terminate"
- exit;
- fi
- #find to display all the filenames with correct naming convention and format
- #due to potentially thousands of files, this isn't recommended for larger projects
- echo "
- List of all suitable files found:
- "
- find $2 -name "IMG_[0-9][0-9][0-9][0-9].JPG" -exec echo {} \;
- #copies all image files (with unique filenames) over to the archive
- find $2 -name "IMG_[0-9][0-9][0-9][0-9].JPG" -exec cp {} $1 \;
- echo "
- All unique images archived in $1";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement