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.4) / Xcode 5.1.1 / RubyMotion FTW
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.4) / Xcode 5.1.1 / RubyMotion FTW
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

Similar Threads
thread Thread Starter Forum Replies Last Post
How to create sub-mailboxes with Applescript? torchy Mac Programming 14 May 29, 2014 04:21 PM
[Applescript] Comaparing two folders' contents BobRon Mac Programming 6 Apr 14, 2014 01:52 AM
I want to make AppleScript Create Folder DavidBlack Mac Programming 27 Mar 15, 2013 06:18 PM
Use AppleScript to create a PPI Calculator? TheMTtakeover Mac Programming 1 Dec 26, 2012 10:11 AM
AppleScript to zip sub folders on a volume kevinless Mac Basics and Help 2 Nov 11, 2012 05:37 PM

Forum Jump

All times are GMT -5. The time now is 07:27 PM.

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

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