Skip to content

Instantly share code, notes, and snippets.

@srounce
Created March 8, 2017 18:07
Show Gist options
  • Save srounce/9c54fe972115008f736394913ab186c7 to your computer and use it in GitHub Desktop.
Save srounce/9c54fe972115008f736394913ab186c7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
target_dir=$(dirname $1);
dest_dir=$(dirname $2);
count=1
for file in $(ls $target_dir); do
filename=$(basename $file)
targetname=$(basename $2)
targetname=${targetname%.*}
size=""
if [ $count != 1 ]; then
size="@${count}x"
fi
echo ${target_dir}/$file → $dest_dir/${targetname}${size}.${filename##*.}
mv ${target_dir}/$file $dest_dir/${targetname}${size}.${filename##*.}
((count++))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment