Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- for f in `ls -p | grep -v /`; do
- file="$f"
- modtime=`stat --format=%Y "$file"`
- year=`date --date @$modtime +%Y`
- if [ ! -d "$year" ]; then
- mkdir -p "$year"
- fi
- echo "Moving $file to $year..."
- mv "$file" "$year/"
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement