Advertisement
cd62131

Move files

Feb 20th, 2014
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.30 KB | None | 0 0
  1. #!/bin/bash -e
  2. if [[ ! -d $1 ]]; then
  3.   echo "usage: $0 DIR"
  4.   exit 1;
  5. fi
  6. mkdir -p /tmp/tmp$$
  7. for dir in $1/*; do
  8.   if [[ ! -d $dir ]]; then
  9.     continue
  10.   fi
  11.   for jpg in $dir/*.jpg; do
  12.     mv $jpg /tmp/tmp$$/$(basename $dir)_$(basename $jpg)
  13.   done
  14.   rmdir $dir
  15. done
  16. mv /tmp/tmp$$ JPEG
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement