Need to copy folder and some subfolders

I am working on writing a script that will allow a user to mount a volume (that part is easy), select a folder on the volume, then copy it to her hard drive where she will then burn it to CD for archiving.

The trick is that she does not need all of the subfolders, just some of them.

Example - the folder structure looks like this:

Issue (parent folder)
—COV15 (first level of subfolder)
------Images (second level of subfolders)
----------Art (third level - Do need to copy this)
----------Imaging (third level - Do NOT need to copy this)
------Quark (second level of subfolders - DO NEED to copy this)

I am not sure how to have Applescript select either which folders or which files to NOT copy. Any advice or help would be appreciated.



Are the folder names and structure the same on all volumes?

The name of the parent folder will change (which doesn’t matter as I am using the “Choose Folder” command)

The only other folder names that will be different art the ones which are the first level subfolders (e.g. COV15, DAS15, etc) There will be a number of these and they will not always be the same.

All other subfolder names will remain the same.for all “issues”

So, is there only one folder at the first sub-level of the parent (chosen) folder? And this sub-folder will always contain a folder named “Images”, correct? And out of the whole structure, you only need to copy the “Art” folder, correct?

If all of my assumptions are correct, would you test the following snippet on a few volumes and see if it always points to the correct “Art” folder? Check the result window in Script Editor for the path.

set chosen_ to (choose folder)
tell application "Finder"
	set cover_ to first folder of chosen_ as alias
	set images_ to folder "Images" of cover_ as alias
	set art_ to folder "Art" of images_ as alias
end tell


– Rob


First of all, thank you for your help. Just wanted you to know that I appreciate it.

Second, your assumption is exactly correct, but that is because I wasn’t clear on the directory structure. There will actually be a number of folders in the first sublevel (e.g. COV01, ASK01, COS01, etc.) Some of these will be in ever issue, but some will be different. However, you are correct in that all of these folders, they will contain two more folders (Images, Quark), and inside of the Images folder, there will be two more called “Art” and “Imaging”. I basically need to back everything except the “Imaging” folders.

The snippet you provided above does work, the problem will be going through all of the folders and looking for the same thing, then copying them all over to a local hard drive.

It seems like the best way would be to use a repeat statement, but I am not quite sure how to proceed.

Once again, thank you for your time and any suggestions you have are appreciated.



If you can provide (make available for download) an example of the file/folder structure, it will make it much easier to offer help. This can be accomplished by creating an archive that accurately represents the naming conventions and hierarchy that the script will encounter (if needed, appropriately named dummy files can be used to protect sensitive data).

– Rob (who is dizzy from trying to comprehend your needs) :stuck_out_tongue:

Rob, I just sent you an email with directions on where to download the folder structure I am talking about. Hope it helps clarify things. If you don’t get the email, let me know.