mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
18 lines
346 B
Bash
Executable file
18 lines
346 B
Bash
Executable file
#!/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
|