Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

move file by filename via applescript?

I have a load of files that are desposited on my user desktop via ftp. Each of these files begins with the same six letters. It is a pain to select all of the files manually and then pull them into a folder. I have looked extensively and have tried unsuccessfully to create an applescript that will do the following:


Take the files with fileNames containing "XXXXX" (or beginning with "XXXXX") at "mac HD:user:me" and move them to the folder "XXXXX" at "mac HD:user:me."


These files all end with the same extension, so I could also delimit the files to be moved by using their extension, if that is a better solution.


Lastly, it would be great if I could also set the above action to occur automatically at some interval.


I can't imagine that the above sort of action is difficult via applescript, but I must admit that a solution eludes me. If someone happens to have a script that accomplishes this sort of action that thery might share, please let me know.


Thanks

Mac mini, OS X Mountain Lion (10.8.3)

Posted on Apr 10, 2013 5:11 PM

Reply
4 replies

Apr 10, 2013 5:32 PM in response to vdarkbloom

Open Automator and select Folder action from the options. If it doesn't offer any types to choose from, select New from the File menu.

Set the Receives folder to Desktop

Drag in a Filter Finder Items action from the Files &Folders Library.

Set it to All of the following are true:

Name begins with XXXXXX

Drag in a Move Finder Items

Set the Folder to wherever you want it to move the files


Save this and it should move all the files that come into the folder.


User uploaded file

Nov 30, 2015 11:56 AM in response to vdarkbloom

I love this automated solution better then applescript, however is there a way to make this run at login, instead of when items are added to this folder? The only reason for this is that the program I'm working with will create a folder/files in this location, and if they are immediately moved while the session is open, that could cause a problem. Any help is greatly appreciated.

Nov 30, 2015 12:36 PM in response to vdarkbloom

I tried to edit my existing reply but this site wouldn't let me. If I try to convert the folder action workflow to an application, it the folder action input goes away. So I substituted that action for find finder items but it still doesn't work as an application outside of Automater (I assume that's because it wants me to drag the folder onto the application). Also, automator seems to get rid of the folder structure when it moves folders/files. 😟 Is there a reason for this?

move file by filename via applescript?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.