Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Moving files automatically

Moving files automatically
Thread Tools
Fresh-Faced Recruit
Join Date: Jan 2006
Status: Offline
Reply With Quote
Apr 29, 2006, 04:39 PM
 
I'm not sure if this is possible or not, but I think it might could be done with AppleScript. What I want to happen is whenever a torrent file is downloaded to the desktop, I want the file to be automatically moved to a torrent folder I've created. Can this be done?
     
Kenelm  (op)
Fresh-Faced Recruit
Join Date: Jan 2006
Status: Offline
Reply With Quote
Apr 29, 2006, 04:55 PM
 
OK. I just accomplished what I wanted to happen with Automator and a Folder Action. Though this way seems a little slow. It takes around five seconds for the computer to realize there are torrent files on the desktop and to move them. Is there a quicker way? Or is this the only way?
     
Kenelm  (op)
Fresh-Faced Recruit
Join Date: Jan 2006
Status: Offline
Reply With Quote
Apr 29, 2006, 06:54 PM
 
In viewing the script in TextEdit, I see that the delay is happening because the script is running the Automator app that was created to find & move all files on the Desktop with the extension .torrent. I would imagine there's a way to bypass the app, and instead perhaps use if/else commands. But I haven't a clue how that would be done.
     
Kenelm  (op)
Fresh-Faced Recruit
Join Date: Jan 2006
Status: Offline
Reply With Quote
May 1, 2006, 03:43 PM
 
Anything guys?
     
Administrator
Join Date: Apr 2001
Location: San Antonio TX USA
Status: Offline
Reply With Quote
May 1, 2006, 03:44 PM
 
Why not just select a different location for the torrents to save to?
Glenn -----
OTR/L, MOT, Tx
     
Fresh-Faced Recruit
Join Date: Feb 2006
Location: OC
Status: Offline
Reply With Quote
May 1, 2006, 04:05 PM
 
not sure which bit torrent client you are using but, I'm using Azureus and in the preference menu I can set up where the downloaded files go to directly without going on the desktop, or I can even leave it so that it will ask me where do I want to place the files when I first start downloading it.

is this what you are talking about?
     
Kenelm  (op)
Fresh-Faced Recruit
Join Date: Jan 2006
Status: Offline
Reply With Quote
May 1, 2006, 05:31 PM
 
I'm only referring to the actual .torrent file. I have Safari set to save all files to the Desktop. What I want to happen is that whenever a .torrent file is downloaded, it gets automatically moved to another folder. Does that make more sense?
     
Administrator
Join Date: Apr 2001
Location: San Antonio TX USA
Status: Offline
Reply With Quote
May 1, 2006, 07:57 PM
 
Originally Posted by Kenelm
I'm only referring to the actual .torrent file. I have Safari set to save all files to the Desktop. What I want to happen is that whenever a .torrent file is downloaded, it gets automatically moved to another folder. Does that make more sense?
Nope. You want them in a specific folder, so why not have them go there to begin with? Still lost here...
Glenn -----
OTR/L, MOT, Tx
     
Kenelm  (op)
Fresh-Faced Recruit
Join Date: Jan 2006
Status: Offline
Reply With Quote
May 1, 2006, 08:25 PM
 
Originally Posted by ghporter
Nope. You want them in a specific folder, so why not have them go there to begin with? Still lost here...
OK. With the option in Safari, Save downloaded files to:, applications, images, videos, .torrents, all kinds of files are downloaded to my Desktop. I'm never asked where to send them. They all go to my Desktop. I like this function.

I want Safari to continue to do what it's doing; I simply want whenever a .torrent file is downloaded to be moved to another folder.

If you read my first posts, I accomplished this with Automator. Via Folder Actions, my Desktop folder is monitored for new files. When it detects one, it checks to see if it has a torrent extension, if it does the file is moved to a folder named Torrents. Yes, it works this way, but it's too slow for my liking. It's slow because of a automator app having to be run everytime a new file on my Desktop is detected.

I'm pretty confident that there's a way to write a simpler and quicker script to accomplish this. I don't know AppleScript but I think it would go something like: monitor Desktop folder for new files, if new file has torrent extension, move to Torrents folder, if not do nothing.

Does this clear it up what I'm trying to do?
     
Mac Elite
Join Date: Feb 2001
Location: Sitting in front of computer
Status: Offline
Reply With Quote
May 2, 2006, 12:32 PM
 
This is pretty easy.

One way is to use Azureus as your bittorrent application - as Azureus has an option to monitor a specific place for .torrent files and then add them.

The other is similar to what I do - use a simple unix copy command with cron (cron lets you schedule tasks)

To do this:

Download a program called "Cronnix" from MacUpdate or similar.

Cronnix is a easy front end to cron.

Run cronnix and choose "new"

Check the Hour, Day of Month, Month and Day of week checkbox (a * should appear int he box next to them).

In Minute type "2,4,6,8,10.. " all the way to 58

You have just set this command to be run every 2nd minute (you can change it to every minute if you wish).

In the Command section at the bottom you type in the command you want to have run every 2nd minute (or whatever schedule you have set)

lets say you want to move every .torrent file from the desktop to a folder called "Torrents" in your home folder, then the command you would type in "Command" is:

Code:
mv ~/Desktop/*.torrent ~/Torrents
where ~ represents you home folder, and the *.torrent indicates anything ending in .torrent
I free'd my mind... now it won't come back.
     
Kenelm  (op)
Fresh-Faced Recruit
Join Date: Jan 2006
Status: Offline
Reply With Quote
May 2, 2006, 03:03 PM
 
Originally Posted by RevEvs

Code:
mv ~/Desktop/*.torrent ~/Torrents

OK. Now we're getting somewhere. Just for my own learning, I wanted to elaborate on that code. Looking at the script from an Automator app script and Google, I tried this AppleScript code:

on adding folder items to this_folder after receiving added_items
do shell script "mv ~/Desktop/*.torrent ~/Torrents"
end adding folder items to

This script now appears to be working.
     
Mac Elite
Join Date: Feb 2001
Location: Sitting in front of computer
Status: Offline
Reply With Quote
May 2, 2006, 03:36 PM
 
yep that seems to be fine. hmm i might even change my cron job to be a applescript folder action!
I free'd my mind... now it won't come back.
     
Mac Elite
Join Date: Feb 2001
Location: Sitting in front of computer
Status: Offline
Reply With Quote
May 2, 2006, 03:41 PM
 
Ok i have to thank you for reminding me of folder actions - that script is much cleaner and simpler than my cron job!
I free'd my mind... now it won't come back.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:52 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2