Automator question

Joined
Jun 7, 2004
Messages
109
Reaction score
1
Points
18
ok so i want to create a workflow that takes close to 300 named files and creates folders and places them in their designated folder according to their name. for example. I have files 30_01_03, 30_02_01, 30_02_02, 29_01_02, 29_01_02, 29_02_03. I want it to then make a folder named "30" and have it take any file with the 30 as it's first two numbers to be moved into it. then have it make a "29" folder and have it move all files starting with 29 into it. Get the idea?

if you could walk me through how to do this that would be great as i don't have much experiance with automator but i've heard it is made to do these sort of tasks for you. thank you for your time.
 
Joined
May 26, 2005
Messages
243
Reaction score
16
Points
18
Location
Walsall, England
Kutless217 said:
anyone anyone?

I may be wrong but I think this would be easier to do in applescript. It should be easy to make the folders, and then you need an if statement that loops over all the files and moves them. The one thing you need to be able to do is be able to extract the first two characters from the name of the file.

If you have the time I suggest you try this, applescript really is something very cool to learn, I am only starting myself. If you need help starting then let me know.
 
OP
K
Joined
Jun 7, 2004
Messages
109
Reaction score
1
Points
18
yeah i have no idea how to make applescripts at all. it would be a huge help if you could explain how to do this.
 
Joined
May 26, 2005
Messages
243
Reaction score
16
Points
18
Location
Walsall, England
It would be really hard to explain how to do it as it's something you just need to learn and pick up bits of information here and there (I do it mostly from reading other people's code). It's not worth it unless you are really interested. Anyway, here is a script that will make 30 folders labled 1 to 30. The folders will be created in a folder called "somefolder" on your desktop, you can copy the 30 folders to somewhere you like and just trash the "somefolder" when you're done:

Code:
tell application "Finder"
	make new folder at desktop with properties {name:"somefolder"}
end tell

set someFolder to (path to desktop as text) & "somefolder:" as alias

tell application "Finder"
	
	repeat with i from 1 to 30
		make new folder at someFolder with properties {name:(i as text)}
	end repeat
end tell

To actually run the script, Go to your applications folder and look for a folder called applescript, inside there is an app called Script Editor, open it up. Now copy the script I've put here and paste it into the script editor window. Now just click the run button. If you want to keep the script for future use or reference then you can save the script from the File menu like you would any other document.

As for the rest of your problem, I'm afraid it's beyond me at the moment, I can't find the command you need, it might be possible with a command called "offset" but it's not exactly what you'd need and you'd have to write a lot of code to get it to do what you want I think.

One thought has occurred to me though, now that you have the 30 folders, would it be possible to go to the folder where you have all your files and sort them alphabetically? you can then select blocks of files with the same starting name and just drag and drop. It's still a bit of a pain, but its a lot quicker than the initial manual task.

Sorry I can't help any further, maybe someone else can?
 
OP
K
Joined
Jun 7, 2004
Messages
109
Reaction score
1
Points
18
thanks that was helpful. are there any sites i can look to for reference to learn apple scripts. I've always wanted to learn how to i just haven't really had a use for it yet.
 
Joined
May 26, 2005
Messages
243
Reaction score
16
Points
18
Location
Walsall, England
This is a good place to start - http://www.apple.com/macosx/features/applescript/resources.html

Best way to learn is to look at example code and what it is supposed to do and see if you understand what it is doing (applescript is designed so it can be read almost like reading normal english). Also a good thing to read through once you have the basics is the library (open up script editor and select the "Window" menu and then "Library". If you double click on any of the apps listed there you will get a libaray window appear of all the commands the app can receive). Some apps might not be present in the Library by default but you can add them. Not all apps support applescript, but most I've come across do.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top