mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-18 22:54:00 +00:00
19 lines
346 B
Text
19 lines
346 B
Text
|
#!/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
|