Skip to content

Instantly share code, notes, and snippets.

@JasonMillward
Created September 13, 2013 02:13
Show Gist options
  • Save JasonMillward/6546134 to your computer and use it in GitHub Desktop.
Save JasonMillward/6546134 to your computer and use it in GitHub Desktop.
#!/bin/bash
txtred='\e[0;31m'
txtprp='\e[1;35m'
txtgrn='\e[0;32m'
txtrst='\e[0m'
find /mnt/kronos -type f | while read -r line; do
if [[ $line == */Anime/* ]]
then
NEWPATH=$(echo $line | sed -e 's/kronos/apollo/g')
fi
FILENAME=$(basename "$line")
if [[ -z "$NEWPATH" ]]
then
echo -e "${txtred}[ ERROR ]${txtrst} \$NEWPATH not set"
else
mkdir -pv "$(echo $NEWPATH | sed -e "s/$FILENAME//g")"
rdd-copy -q -f -n 5 --progress 1 "$line" "$NEWPATH"
echo $NEWPATH
if [[ -f "$NEWPATH" ]]
then
echo -e "${txtgrn}[SUCCESS]${txtrst} $FILENAME"
else
echo -e "${txtred}[ Error ]${txtrst} $line"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment