Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- lastfile=""
- if [[ ! -e "$1/old/" ]]; then
- mkdir "$1/old/"
- fi
- for file in $(ls -r $1); do
- stripped=$(echo "$file" | cut -d'-' -f1)
- if [[ "$stripped" == "$lastfile" ]]; then
- mv "$1/$file" "$1/old/"
- fi
- lastfile=$stripped
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement