Register FAQ/Rules Forum Spy Search Today's Posts Mark Forums Read

Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate.

 
Go Back   Mac Forums > Apple Software > Mac OS X Forums > Mac OS X
TouchArcade.com - iPhone Game Reviews and News

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 19, 2009, 02: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
__________________
Anyone who thinks that Obama is a "Marxist" is so clueless that it's scary. Consider getting some education.
Evangelion is offline   Reply With Quote
Old Nov 19, 2009, 02:08 PM   #2
roadbloc
macrumors 6502
 
Join Date: Aug 2009
Location: In a house
Send a message via MSN to roadbloc Send a message via Skype™ to roadbloc
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.
__________________
Late 2008 MacBook White. OS X 10.6.2. Runs fine.
roadbloc is offline   Reply With Quote
Old Nov 20, 2009, 03: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.
__________________
Anyone who thinks that Obama is a "Marxist" is so clueless that it's scary. Consider getting some education.
Evangelion is offline   Reply With Quote
Old Nov 20, 2009, 07:52 AM   #4
mysterytramp
macrumors 6502a
 
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   Reply With Quote
Old Nov 22, 2009, 04: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.
__________________
Anyone who thinks that Obama is a "Marxist" is so clueless that it's scary. Consider getting some education.
Evangelion is offline   Reply With Quote
Old Nov 23, 2009, 01: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?
__________________
Anyone who thinks that Obama is a "Marxist" is so clueless that it's scary. Consider getting some education.
Evangelion is offline   Reply With Quote
Old Nov 23, 2009, 03: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....
__________________
Anyone who thinks that Obama is a "Marxist" is so clueless that it's scary. Consider getting some education.

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

Reply

Mac Forums > Apple Software > Mac OS X Forums > Mac OS X

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:57 PM.

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

Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 2002-2010, MacRumors.com, LLC