A while back we've posted about a script called "Directory Cleaner And Files Organizer" that helps you keep various folders clean (such as your Desktop) by automatically moving the files by extension into folders such as Pictures, Documents and so on.
If you remember, I've mentioned it would be nice if it had a command line version so you could automatically run it at startup or in a cron job. Well, an update today brings a command line version of the Directory Cleaner And Files Organizer script.
If you remember, I've mentioned it would be nice if it had a command line version so you could automatically run it at startup or in a cron job. Well, an update today brings a command line version of the Directory Cleaner And Files Organizer script.
To use, download the script, extract it and open "cmd_cleaner" and starting with line 28 of the script you should see something like this:
picdir="/home/$USER/Pictures"
musicdir="/home/$USER/Music"
docdir="/home/$USER/Documents"
videodir="/home/$USER/Videos"
archdir="/home/$USER/Archives"
progdir="/home/$USER/Scripts"
These are the folders where your files will be moved upon cleaning - change them to whatever you want (or leave them as they are). Then make the script executable:
chmod +x /path/to/cmd_cleaner
Then, to clean a folder, use:
/path/to/cmd_cleaner a /home/andrei/Desktop
Of course, change /home/andrei/Desktop in the command above with the path to the folder you want to clean (I've used an exact path because I'm not sure if relative paths / variables work in Cron). "a" stands for advanced cleaning and "s" for simple (so you can replace "a" in the above command with "s") - we've already explained what these do in the previous post.
Now you're ready to add it to a cron job (for a GUI you can use Gnome Schedule) or to your startup applications (System > Preferences > Startup applications - simply add the command like I've explained above).
Note: if you get a bunch of errors when running the script, don't worry about it, the script works but the errors are displayed because it checks multiple times (so this is only a display error which will be fixed soon). The author explanation:
Download Directory Cleaner And Files Organizer
Now you're ready to add it to a cron job (for a GUI you can use Gnome Schedule) or to your startup applications (System > Preferences > Startup applications - simply add the command like I've explained above).
Note: if you get a bunch of errors when running the script, don't worry about it, the script works but the errors are displayed because it checks multiple times (so this is only a display error which will be fixed soon). The author explanation:
The cleaning is working without problem, the error are the second checking result, when the document is already moved. The same is also in the classic cleaner. I will look at this later and will to rewrite it for output without errors.
Download Directory Cleaner And Files Organizer
Tidak ada komentar:
Posting Komentar