-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Duplicate package checker, moves older packages out of the way
- Loading branch information
Mike Staszel
committed
Nov 4, 2010
1 parent
e4e3fd8
commit bb12682
Showing
4 changed files
with
19 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,18 @@ | |||
#!/bin/bash | |||
|
|||
lastfile="" | |||
if [[ ! $* ]]; then | |||
echo "usage: $0 <directory>" | |||
exit 1 | |||
fi | |||
if [[ ! -e "$1/old/" ]]; then | |||
mkdir "$1/old/" | |||
fi | |||
for file in $(ls -r $1); do | |||
stripped=${file%%-[0-9].*} | |||
if [[ "$stripped" == "$lastfile" ]]; then | |||
echo "moved duplicate $1/$file" | |||
mv "$1/$file" "$1/old/" | |||
fi | |||
lastfile=$stripped | |||
done |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.