Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'a bit simpler...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
a bit simpler...
Authored by: tedw on May 13, '09 11:16:26PM
really, all you need to flatten a folder entirely is the following code:
tell application "Finder"
	set theFiles to a reference to every file of (entire contents of folder "old:folder:path")
	duplicate theFiles to folder "new:folder:path"
end tell
This will make a list of references to all the files on all levels of the folder, and then duplicate them into the new folder. duplicate names in the folder hierarchy will be enumerated in classic Mac style (in Andrew's example above I ended up with file1, file1 2, file1 3, file2, file2 2, file3). you could use move instead of duplicate, but that will throw an error for duplicate file names.

[ Reply to This | # ]
a bit simpler...
Authored by: ragmaxone on May 23, '09 12:37:23AM

A bit?
I made a script that does the same, without the "entire contents" thing... it's about 80 lines of code :'(

Thanks for this hint!

[ Reply to This | # ]