First I created a few folders in the downloads folder:
- DL-Compressed
- DL-Firmware
- DL-Programs
- DL-Android
- DL-Documents
- DL-media
After this I created a bash script:
# Move Wetransfer files to tje picure folder
mv ~/Downloads/wetransfer* ~/Pictures/Wetransfer
# Move all Airdroid Files to the DL-Airdroid folder
mv ~/Downloads/Files_downloaded_by_AirDroid* ~/Downloads/DL-Airdroid/
# Move all porn to DL-Media
mv ~/Downloads/*.jpg ~/Downloads/DL-media/
mv ~/Downloads/*.JPG ~/Downloads/DL-media/
mv ~/Downloads/*.png ~/Downloads/DL-media/
mv ~/Downloads/*.PNG ~/Downloads/DL-media/
mv ~/Downloads/*.mov ~/Downloads/DL-media/
mv ~/Downloads/*.MOV ~/Downloads/DL-media/
mv ~/Downloads/*.bmp ~/Downloads/DL-media/
mv ~/Downloads/*.BMP ~/Downloads/DL-media/
mv ~/Downloads/*.jpeg ~/Downloads/DL-media/
mv ~/Downloads/*.JPEG ~/Downloads/DL-media/
mv ~/Downloads/*.gif ~/Downloads/DL-media/
mv ~/Downloads/*.GIF ~/Downloads/DL-media/
mv ~/Downloads/*.tif ~/Downloads/DL-media/
mv ~/Downloads/*.TIF ~/Downloads/DL-media/
# move al compressed files to DL-Compressed folder
mv ~/Downloads/*.zip ~/Downloads/DL-Compressed/
mv ~/Downloads/*.ZIP ~/Downloads/DL-Compressed/
mv ~/Downloads/*.rar ~/Downloads/DL-Compressed/
mv ~/Downloads/*.RAR ~/Downloads/DL-Compressed/
mv ~/Downloads/*.jar ~/Downloads/DL-Compressed/
mv ~/Downloads/*.JAR ~/Downloads/DL-Compressed/
mv ~/Downloads/*.7z ~/Downloads/DL-Compressed/
mv ~/Downloads/*.7Z ~/Downloads/DL-Compressed/
mv ~/Downloads/*.tgz ~/Downloads/DL-Compressed/
mv ~/Downloads/*.TGZ ~/Downloads/DL-Compressed/
# Move all installers to DL-Programs
mv ~/Downloads/*.dmg ~/Downloads/DL-Programs/
mv ~/Downloads/*.DMG ~/Downloads/DL-Programs/
mv ~/Downloads/*.pkg ~/Downloads/DL-Programs/
mv ~/Downloads/*.pkg ~/Downloads/DL-Programs/
mv ~/Downloads/*.prefPane ~/Downloads/DL-Programs/
# Split up all the documents
mv ~/Downloads/*.pdf ~/Downloads/DL-Documenten/DL-PDF/
mv ~/Downloads/*.PDF ~/Downloads/DL-Documenten/DL-PDF/
mv ~/Downloads/*.txt ~/Downloads/DL-Documenten/DL-TXT/
mv ~/Downloads/*.TXT ~/Downloads/DL-Documenten/DL-TXT/
mv ~/Downloads/*.csv ~/Downloads/DL-Documenten/DL-TXT/
mv ~/Downloads/*.CSV ~/Downloads/DL-Documenten/DL-TXT/
mv ~/Downloads/*.htm ~/Downloads/DL-Documenten/DL-TXT/
mv ~/Downloads/*.html ~/Downloads/DL-Documenten/DL-TXT/
mv ~/Downloads/*.HTM ~/Downloads/DL-Documenten/DL-TXT/
mv ~/Downloads/*.HTML ~/Downloads/DL-Documenten/DL-TXT/
mv ~/Downloads/*.cfg ~/Downloads/DL-Documenten/DL-TXT/
mv ~/Downloads/*.CFG ~/Downloads/DL-Documenten/DL-TXT/
mv ~/Downloads/*.tpl ~/Downloads/DL-Documenten/DL-TXT/
mv ~/Downloads/*.TPL ~/Downloads/DL-Documenten/DL-TXT/
mv ~/Downloads/*.doc ~/Downloads/DL-Documenten/DL-Docs/
mv ~/Downloads/*.docx ~/Downloads/DL-Documenten/DL-Docs/
mv ~/Downloads/*.DOC ~/Downloads/DL-Documenten/DL-Docs/
mv ~/Downloads/*.DOCX ~/Downloads/DL-Documenten/Docs/
# Remove windows stuff
rm ~/Downloads/*.exe
rm ~/Downloads/*.EXE
# Verwijderen van overbodige folders (alle niet DL- folders)
find ~/Downloads/. -type d -not -name 'DL-*' -print0 | xargs -0 rm -R
# Remove files from Compressed after 30 days.
find ~/Downloads/DL-Compressed/* -mtime +30 -exec rm {} \;
Now i added the file to the crontab
Create a file called crontab.txt
fill it up with:
15 * * * * ~/scripts/download.sh &> /dev/null
Now put it in the crontab:
crontab crontab.txt
Check your crontabs with:
crontab -l
Clear your crontabs with:
crontab -r
Geen opmerkingen:
Een reactie posten