New Guy: Script to recursively execute files in a specific folder

Hey everyone, I’m the latest New Guy! :smiley:

I’m totally new to AppleScript, but I’m familliar with PHP and bits of other languages, so you need not go too easy on me. In any case, here’s what I’m looking to do;

I have a folder that contains downloaded files, let’s call it “Downloads”. That folder contains other folders named according to the content downloaded. (FWIW, the files are originating from the Unison news reader.) Those folders in turn contain a collection of archive parts, and numerous PAR recovery files (*.par2). Executing any one of those .par2 files will run the appropriate application to verify and decompress the archives. So that last part is already automated. What I am trying to do is write a script that will examine the contents of that main downloads folder, drill down from it to find the .par2 files in the subfolders, and execute them. The catch is, it must only execute one of the .par2 files per sub-folder. There are generally 6+ .par2 files per folder. I really have no idea where to start, and just need poked in the right direction. Thanks!!

cscade:

check out the discussion here: bbs.applescript.net/viewtopic.php?id=16002. I commented my code so you can see the thought process. The core is essentially there.

Good Luck,
Jim Neumann
BLUEFROG

Thanks BLUEFROG, this is indeed helpful. Would there be a simple way to tell the parser to ignore any file names containing the “+” character?

You can have the Finder look at the filenames and give you a list of ones containing characters. Here’s a simple example…


tell app "finder"
	every file of desktop whose name does not contain "+"
end tell

Of course, replacing “of desktop” with whatever path you’re looking at.

Jim

Very nice. The simple wording of applescript actually makes it harder for me to grasp at first :stuck_out_tongue:

I’ve got a rather functional script going now, thanks so much for your help. I’ll post back to this thread with further questions if they arise.