Advertisement
metalx1000

Move all Files to folders based on month and day

May 24th, 2015
699
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.24 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. for file in *
  4. do
  5.   month="$(stat -c %y "$file"|cut -d\- -f2)"
  6.   day="$(stat -c %y "$file"|cut -d\- -f3|awk '{print $1}')"
  7.   mkdir -p ./$month/$day
  8.   echo "Moving $file to ./$month/$day..."
  9.   mv "$file" "./$month/$day/"
  10. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement