Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > OS X

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 19, 2009, 01:06 PM   #1
Evangelion
macrumors 68040
 
Join Date: Jan 2005
Copying new files to another folder with Folder Action?

Is there a way to create a folder-action that accomplishes what I'm about to describe?

I have iTunes-library (like most of us do). What I would like to accomplish is to copy my library to a server on my network. Of course I can do the initial copying manually, but what I would like to do is that whenever I add content to my library, a folder action kicks in, and copies that new content to the server.

Now, I created a folder action with Automator, and it kinda works. What it does is that it looks at certain folder, gets folder-contents (subfolders included, since iTunes-library resides in subfolders), and copies them to another folder. It works, but what happens is that it copies the subfolders and their contents AND the individual files separately. I mean that if I copy a folder called XXXX which contains subfolders called ZZZZ and YYYY, which in turn contain files ABCD and 1234, it doesn't copy the folder XXXX, but it does copy the subfolders ZZZZ and YYYY and their contents. All well? Well, no, since it also copies the individual files (ABCD and 1234) to the root of the destination-folder. What I would like to copy the folders in similar way they are in the original folder.

Also, what happens when I reboot my computer? When I log back in, would the folder copy the entire folder-structure all over again? I mean, I log in, the folder-actions runs, and copies the contents of the folder. What I would like it to do is to only copy files over when new files/folders are added.

Any advice is welcome
__________________
"One way or another, you're gone"
Tea Party protester to Gaby Giffords
Evangelion is offline   0 Reply With Quote
Old Nov 19, 2009, 01:08 PM   #2
roadbloc
macrumors 604
 
roadbloc's Avatar
 
Join Date: Aug 2009
Location: UK
Quote:
Originally Posted by Evangelion View Post
Any advice is welcome
I second this. I have been attempting to see if it can be done without 3rd party apps for a while now.
__________________
roadbloc is offline   0 Reply With Quote
Old Nov 20, 2009, 02:04 AM   #3
Evangelion
Thread Starter
macrumors 68040
 
Join Date: Jan 2005
Alternatively, instead of copying the entire folder-structure, the script could ignore the folders, and just copy actual files contained in those folders. That would work as well. Of course it would have to monitor all the folders and subfolders for new files.
__________________
"One way or another, you're gone"
Tea Party protester to Gaby Giffords
Evangelion is offline   0 Reply With Quote
Old Nov 20, 2009, 06:52 AM   #4
mysterytramp
macrumors 65816
 
mysterytramp's Avatar
 
Join Date: Jul 2008
Location: Maryland
Wouldn't something like SyncTwoFolders work just as well?

mt
__________________
What looks large from a distance, close up ain't never that big.
mysterytramp is offline   0 Reply With Quote
Old Nov 22, 2009, 03:05 AM   #5
Evangelion
Thread Starter
macrumors 68040
 
Join Date: Jan 2005
Quote:
Originally Posted by mysterytramp View Post
Wouldn't something like SyncTwoFolders work just as well?

mt
That just might do it, thanks . I just have to make sure that I can make it sync in one direction only.
__________________
"One way or another, you're gone"
Tea Party protester to Gaby Giffords
Evangelion is offline   0 Reply With Quote
Old Nov 23, 2009, 12:41 PM   #6
Evangelion
Thread Starter
macrumors 68040
 
Join Date: Jan 2005
I'm testing SyncTwoFolders, and I don't think it's the solution I'm looking for. The files are supposed to be copied to "Automatically add to iTunes"-folder. When files are added there, they are imported to iTunes and moved to the iTunes library-folder. So the target-folder will always be empty.

Now, the problem with SyncTwoFolders is that it will copy all files not present on the target-folder from the source-folder. And since the target-folder will always be empty, ti would copy the files over and over again.

Also, how would I make SyncTwoFolders run every time new files are added to the folder?

So, I'm still looking. Any suggestions?
__________________
"One way or another, you're gone"
Tea Party protester to Gaby Giffords
Evangelion is offline   0 Reply With Quote
Old Nov 23, 2009, 02:57 PM   #7
Evangelion
Thread Starter
macrumors 68040
 
Join Date: Jan 2005
I have managed to take one step closer to the solution, but I'm stuck again.

My original solution was a Automator-script that gets folder content from the source-folder and copies that content over to the target-folder. But the problem was that it copied the files AND the folders (so the coped content was multiplied).

What I did was that I added a third step to the workflow (between "get folder contents" and "copy Finder items"): "Filter Finder items". That step just contains a "kind is not folder"-filter (so that it does not select them for copying). And it does seem to work, since it only copies the contents of folders and subfolders, but not the actual folders.

But there is a problem. If I add a song to that subfolder, that song is NOT copied over. If I copy it to the root of the folder, then it works. I have selected the "repeat for each subfolder found" in the first step of the Automator-script, but it doesn't seem to help. So it seems that the script only monitors the root-folder. If I add a file or subfolder to the root of the folder, the script works beautifully. But if I add a file to an existing subfolder (for example, download a new podcast episode to a show I subscribe to, or buy more songs from an artist who already has other songs in my library) the script does not run.

Am I at the end of the line as far as Automator is concerned? Is AppleScript the next step?

EDIT: If I add "Get specified Finder items" as the first step in Automator, and add the test-folder there, then the script works beautifully inside Automator. But if I save that workflow as a Folder Action, it does not work.

EDIT2: I think this thread should be moved to the programming-forum, since this is about scripiting....
__________________
"One way or another, you're gone"
Tea Party protester to Gaby Giffords

Last edited by Evangelion; Nov 24, 2009 at 01:49 AM.
Evangelion is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > OS X

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Triggering folder action on dropbox folder? ronswanson Mac Programming 3 Aug 7, 2013 03:39 PM
Copying files to folder with similar names Music_Producer OS X 0 Jul 31, 2013 07:08 PM
Action Folder in /Volumes/ DKnow75 Mac Programming 5 Jun 15, 2013 07:12 AM
Automatically move files created in a folder to a folder that has their name... Help? iansilv OS X 1 Mar 26, 2013 03:20 PM
Copying files directly to folder in PDF Expert bbrame iPad Apps 2 Dec 20, 2012 07:23 AM

Forum Jump

All times are GMT -5. The time now is 03:55 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC