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

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 29, 2013, 06:07 AM   #1
joennie
macrumors newbie
 
Join Date: Jul 2013
create folders applescript

I have a folder with x ammount of subfolders which all contain images.

I need to create the same folder structure but within each folder I need to create a 2 folders, thumbnails and fullsize images and then process each original folder and insert the images into the correct folders

Current format

main folder > imagefolderone > img1
img2
img3

imagefolderone > img1
img2
img3

Required format

main folder > imagefolderone > thumbnail_folder >
thumbnail image1
thumbnail image2
thumbnail image3
main_folder >
main image1
main image2
main image3

> imagefoldertwo > thumbnail_folder >
thumbnail image1
thumbnail image2
thumbnail image3
main_folder >
main image1
main image2
main image3
joennie is offline   0 Reply With Quote
Old Jul 29, 2013, 07:43 PM   #2
Red Menace
macrumors regular
 
Join Date: May 2011
Location: Littleton, Colorado, USA
There are several different ways to create folder structures, but sometimes it is easier to create the desired structure using the normal Finder commands, and then copy the template as needed.

Code:
on run -- example
	copyFolderStructure from (choose folder with prompt "choose source folder") to (choose folder with prompt "choose destination folder")
end run

to copyFolderStructure from sourceFolder to destinationFolder
	tell application "Finder"
		repeat with someFolder in (get folders of sourceFolder)
			get name of someFolder
			try
				make new folder at destinationFolder with properties {name:result}
			on error number -48 -- ignore duplicate file name, but continue traversing the structure
				get ((destinationFolder as text) & result) as alias
			end try
			my (copyFolderStructure from someFolder to result)
		end repeat
	end tell
	return
end copyFolderStructure
__________________
MacBook Pro / OS X Mavericks (10.9.2) / Xcode 5.1 / [and various (much) older stuff keeping dust off the shelves]
Red Menace is offline   1 Reply With Quote
Old Jul 30, 2013, 12:02 AM   #3
joennie
Thread Starter
macrumors newbie
 
Join Date: Jul 2013
Thanks so much...if I want to add a generic thumbnail folder, would that be done in the same code, or would I run a separate applescript
joennie is offline   0 Reply With Quote
Old Jul 30, 2013, 06:43 PM   #4
Red Menace
macrumors regular
 
Join Date: May 2011
Location: Littleton, Colorado, USA
You can add folders to the template and use the same script to update an existing structure.
__________________
MacBook Pro / OS X Mavericks (10.9.2) / Xcode 5.1 / [and various (much) older stuff keeping dust off the shelves]
Red Menace is offline   1 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

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

BB 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 10:53 PM.

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

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