I use my ibook all day long at work at home at school, for everything. All of my documents started getting messy in the Documents folder. It was my place to kind of throw everything. So after reading this article I decided to do something about it becuase the mess in my documents folder was kind of bothering me. Being a long time linux user I decided the best approach to this would be just to do what I know. So I wrote the following little simple bash script:
All of these directories I created before writing the script my initial plan was just to move stuff around. So I made my little script executable and created a cron job for it to run every minute. Now all I have to do is save my stuff into my Documents folder and it gets organized very neatly into the correct folders a minute later.
I also thought what if I save something to my documents folder and it gets moved over but I am still working on it. Even if this were the case though what ends up happening is that it just moves the newer saved copy over the otherone and overwrites everything. After I did this I dropped a few more files into the documents folder and it worked perfectly. I just want to take some time now to layout the steps so that anyone could do it.
1. Decide your directory structure
2. Create any folders you want in your documents folder
3. Open your favorite text editor and copy my above script into it making any changes you feel are necessary, adding extensions etc.
4. Save it where ever you want I chose to save it under the name relocator.sh in a directory called "Scripts" I made in my home directory.
5. open a terminal
6. type "cd ~/Scripts"
7. type "chmod +x relocator.sh" this will make the file executable so that you can run it from a cronjob
8. type "./relocator.sh" to do a test run on your script it should now be moving all of your documents around and the changes should reflect in the finder.
9. If you like the desired results type and wish to automate it to run every x minutes. Edit your user crontab by typing "crontab -e"
10. In my case I had one line in this file that ipodderx uses to automatically grab streams from podcasting feeds you will probably just see an empty window with a bunch of ~'s in it.
11. Hit the "i" key this will allow you to insert text in the vi editor.
12. Paste the following line into the terminal: */1 * * * * ~/Scripts/relocate.sh
13. This will automatically run the relocate script every 1 minute. You can change 1 to whatever interval you wish.
14. Enjoy having an organized Documents folder.
If anyone has any feedback on my little solution for a messy documents folder or any improvments for my script please respond. Good luck.
Armando
Code:
#!/bin/bash
cd ~/Documents
mv *.doc Office\ Documents/
mv *.ppt Office\ Documents/
mv *.xls Office\ Documents/
mv *.pdf PDF\'s/
mv *.jpg Images/
mv *.ai Images/
mv *.psd Images/
mv *.png Images/
mv *.tif Images/
mv *.ooutline Outlines/
mv *.* Other/
All of these directories I created before writing the script my initial plan was just to move stuff around. So I made my little script executable and created a cron job for it to run every minute. Now all I have to do is save my stuff into my Documents folder and it gets organized very neatly into the correct folders a minute later.
I also thought what if I save something to my documents folder and it gets moved over but I am still working on it. Even if this were the case though what ends up happening is that it just moves the newer saved copy over the otherone and overwrites everything. After I did this I dropped a few more files into the documents folder and it worked perfectly. I just want to take some time now to layout the steps so that anyone could do it.
1. Decide your directory structure
2. Create any folders you want in your documents folder
3. Open your favorite text editor and copy my above script into it making any changes you feel are necessary, adding extensions etc.
4. Save it where ever you want I chose to save it under the name relocator.sh in a directory called "Scripts" I made in my home directory.
5. open a terminal
6. type "cd ~/Scripts"
7. type "chmod +x relocator.sh" this will make the file executable so that you can run it from a cronjob
8. type "./relocator.sh" to do a test run on your script it should now be moving all of your documents around and the changes should reflect in the finder.
9. If you like the desired results type and wish to automate it to run every x minutes. Edit your user crontab by typing "crontab -e"
10. In my case I had one line in this file that ipodderx uses to automatically grab streams from podcasting feeds you will probably just see an empty window with a bunch of ~'s in it.
11. Hit the "i" key this will allow you to insert text in the vi editor.
12. Paste the following line into the terminal: */1 * * * * ~/Scripts/relocate.sh
13. This will automatically run the relocate script every 1 minute. You can change 1 to whatever interval you wish.
14. Enjoy having an organized Documents folder.
If anyone has any feedback on my little solution for a messy documents folder or any improvments for my script please respond. Good luck.
Armando