Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nicolanicola

macrumors member
Original poster
Jan 11, 2009
73
0
I have a folder structure as follows all items>item name>item colour>files.

Now in this item colour folder are 2 files, a large sized image and a thumbnail version of that image. I need to create a folder in here called thumbnail and move the thumbnail image into it. Can I do this with automator?

I have maybe about 30 item name folders with various amounts of folders within each of those.

If I was to say what it was in code terms it'd be for every folder in all items,open folder then go in every folder in here and create a directory called thumbnail and move the file named closeupTN.jpg into here.

I've attached a folder structure. It starts from the contents of 'all items' in the above description.
 

Attachments

  • Screen Shot 2012-03-05 at 16.54.20.png
    Screen Shot 2012-03-05 at 16.54.20.png
    57 KB · Views: 62
Last edited:

kryten2

macrumors 65816
Mar 17, 2012
1,114
99
Belgium
Try this little script

I assume all items is a folder? Choose this toplevel folder in the choose folder dialog when you run the script.

Code:
set the_folder to (choose folder with prompt "Choose your “all items“ folder")
set FilenamesList to paragraphs of (do shell script "find " & quoted form of POSIX path of the_folder & " -type f -name *TN.jpg")
repeat with i from 1 to count of FilenamesList
	set thisFileObject to (POSIX file (item i of FilenamesList) as alias)
	-- do something with the file object "thisFileObject"
	tell application "Finder"
		try
			set tumbnailFolder to make new folder in container of thisFileObject with properties {name:"thumbnail"}
			move thisFileObject to tumbnailFolder
		on error errMsg number errNumber
			display alert errMsg message errNumber
		end try
	end tell
end repeat
 

Attachments

  • Afbeelding 1.png
    Afbeelding 1.png
    136.2 KB · Views: 54
  • Afbeelding 2.png
    Afbeelding 2.png
    129.3 KB · Views: 53
  • Afbeelding 3.png
    Afbeelding 3.png
    114.2 KB · Views: 59
  • Afbeelding 4.png
    Afbeelding 4.png
    115.9 KB · Views: 63
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.