search in all subfolders

hi there. This is my first script, so you might smile . I have serious tried to find a solution for three days now.

I use a mp3 player application, which has problems with several characters (e.g. slashes) in the file- or pathname. the script should ask for my mp3 folder and find all ProblemFiles or folders and either log them to a text file or move them to a folder of your choice.

The script works fine so far and is contained in here:

my gehtlos(derOrdner, wasTun, dieLogfileLocation, dieMovefileFolderLocation)

BUT: I can´t make it to search all subfolders. Only for one level:

tell application "Finder"
	
	repeat with dieCurrentFolderNummer from 0 to dieZahlDerOrdner
		
		if not dieCurrentFolderNummer = 0 then
			set derOrdner to item dieCurrentFolderNummer of dieFolderList as alias
		end if
		
		my gehtlos(derOrdner, wasTun, dieLogfileLocation, dieMovefileFolderLocation)
		
		set dieCurrentFolderNummer to dieCurrentFolderNummer + 1
		
		
	end repeat
	
end tell

Nay help would be great.

A simple method to get every folder and sub-folder of a chosen folder is to use the entire contents parameter, like this:

set a to choose folder
tell application "Finder" to set b to every folder in entire contents of a

You now have list (b) of every folder and sub-folder in your chosen folder, and you can use a repeat loop to cycle through each folder, and apply your handler to every file in each folder.

Hope this helps,

Oh Man. I have tried so many way, repeatloops in repeatloops…

Thank you.

airbuff:

Check out this discussion… http://bbs.applescript.net/viewtopic.php?id=16002

You should be able to adapt my core. Recursion is a very cool and very confusing thing. Make sure to read the comments in my code to get an idea of what I was thinking. Good luck.

Jim Neumann
BLUEFROG