[Linux] Script to remove nzb site url from folder name (Or anything else)
Posted: September 12th, 2008, 5:33 am
This will remove [nzbmatrix.com] from downloaded folder names. Its adapted from the useful clam virus scan script so they can be combined into one if you wished.
Hope its useful to someone!
Hope its useful to someone!
Code: Select all
#! /bin/sh
BASENAME=`basename "$1"`
echo "Path to download is $1"
echo "Directory is $BASENAME"
echo "Stripped would be ${BASENAME%\[nzbmatrix.com\]}"
if [ "$BASENAME"=*\[nzbmatrix.com\]* ]; then
echo 'Directory name contains [nzbmatrix.com]'
echo "Renaming directory $BASENAME to ${BASENAME%\[nzbmatrix.com\]}"
cd "$1"/..
mv "$BASENAME" "${BASENAME%\[nzbmatrix.com\]}"
else
echo '[nzbmatrix.com] not present in title, all is well!'
fi