#Image format conversion brew install imagemagick #bmp to jpg mogrify -format jpg *.bmp #http://www.imagemagick.org/script/mogrify.php #file rename tool brew install rename #http://plasmasturm.org/code/rename/ # Copy large number of files - a more robust way # operation will commense upon error; # operation will specify defected files # great for use when you have disk issues ➜ ~ rsync -av --log-file=copy.txt --progress /Volumes/source/DATA/* /Volumes/destination/DATA/ ➜ ~ rsync -av --exclude='/home/my_name/directory_with_corrupt_files/*' ➜ ~ tail -f copy.txt #comparing 2 directories diff <(cd /Volumes/TB/Pictures/by\ years/2010 && find . | sort) <(cd /Volumes/Iomega\ HDD/MyData/_private/media/pictures/events/2010 && find . | sort) > 2007.txt # comparing 2 directories for file structure not file-content # http://askubuntu.com/questions/421712/comparing-the-contents-of-two-directories-using-bash ➜ diff <(cd ~/DATA/ && find . | sort) <(cd /Volumes/Seagate/DATA/ && find . | sort) # output # 58130d58129 < ./some/directory/.DS_Store 58284d58282 > ./some/other/directory/image.bmp # comparing 2 directories recursively with file-content compare # http://unix.stackexchange.com/questions/49496/recursively-compare-two-directories-with-diff-r-without-output-on-broken-links ➜ for f in `find ~/DATA/ ! -type l`;do diff -rq $f /Volumes/Seagate/DATA/;done # output # Files /Users/.../DATA/.DS_Store and /Volumes/Seagate/DATA/.DS_Store differ Files /Users/ ... ... # search for files with 'jdk' in their filename and 'Intelli' in their path ➜ find /Users -name "*jdk*" | grep Intelli # output # /Users/odeds/Library/Caches/IntelliJIdea12/jars/bcprov-jdk14-138.jar.4178c67f /Users/odeds/Library/Caches/IntelliJIdea12/jars/json-lib-2.2.2-jdk15.jar.675dc09e # search for files with "hosts" in their path ➜ locate hosts # auto rename files ## first replace all space in file name ➜ for f in *\ *; do mv "$f" "${f// /_}"; done ## dry run replace on current dir only ➜ for i in `ls -1 05-4-*`;do echo mv \"$i\" \"${i//05-4-/05-5-}\";done ## dry run replace- specifying a dir recursively ➜ for i in `find . -name "05-4-*"`;do echo mv \"$i\" \"${i//05-4-/05-5-}\";done ## execute the file renaming ➜ for i in `find . -name "05-4-*"`;do echo mv \"$i\" \"${i//05-4-/05-5-}\";done | /bin/zsh #view mounted dirs in cli ➜ cd /Volumes # remove Picasa "Originals" folder nested within a root Album dir ➜ find . -iname "Originals" -exec rm -rf "{}" + ➜ find . -iname ".picasaoriginals" -exec rm -rf "{}" + # another option using xargs which gave me a too long error ➜ find . -name "Originals" | xargs -0 rm -rf # using jhead to modify jpeg exif data. rewite file create date + modify date+ camera date # basically we create an exif header. Then we set the file date to the exif date then we specify the date ➜ find . -iname "*.jp*g" -exec jhead -mkexif -ft -ds1960:01:01 {} +