Ok, I have this script that I have been practicing with. What it does, is simply looks in my downloads folder and looks for (*.filetype)
Then, it will distribute each file type to specific destinations ie. html to Documents, or mp3 to Music etc.
The script works, but I still get errors such as:
Quote:
mv: cannot stat `/Downloads': No such file or directory
If no file types exist I get similar errors in the shell, but if they do, they are sent to the destination directory, but I still get the above error in the quote.
Here is the script:
Code:
#! /bin/bash
files=$1
files=$(ls /home/dude/Downloads/*.pdf);
files=$(ls /home/dude/Downloads/*.mp3);
files=$(ls /home/dude/Downloads/*.html);
if [[ $1 != 0 ]]
then
cd /home/dude/Downloads && mv *.pdf /Downloads /home/dude/Documents;
mv *.mp3 /Downloads /home/dude/Music;
mv *.html /Downloads /home/dude/Documents;
else
echo "No such file types exist in this directory"
fi