How can i make my script (attached below) look at the files inside of subfolders
to run my name changing script
set errorlog to ""
set nameList to read file ((choose file with prompt "Choose the data file.") as text) as list using delimiter return
set pathTotheFolder to (choose folder with prompt "Select the folder containing the files to rename.") as text
set AppleScript's text item delimiters to tab
repeat with thisNamePair in nameList
set {oldName, NewName} to the text items of thisNamePair
tell application "Finder"
try
set the name of file (pathTotheFolder & oldName) to NewName
on error
set errorlog to errorlog & return & oldName
end try
end tell
end repeat
set errorlog to errorlog as string
set buttonResult to display dialog "These Old Items can not be found" & errorlog buttons {"clipboard", "OK", "EMAIL"}
if button returned of buttonResult is "clipboard" then
set the clipboard to errorlog
else if the button returned of buttonResult is "EMAIL" then
tell application "Microsoft Outlook"
CreateMail Body errorlog Recipients "rdriscoll" Subject "These images are not in Database" without Display
end tell
end if
if folder of (info for thisNamePair) then -- is a folder!
… Or:
if text item -1 of thisNamePair as text is ":" then -- is a folder!
Then, list items within the folder and repeat the loop:
set folders_contents to list folder thisNamePair without invisibles
repeat with i in folders_contents
set this_file to (thisNamePair as text & i as text) as alias
...
A thypical routine for this:
repeat with thisItem in theseItems -- if theseItems are aliases
set the itemInfo to info for thisItem
if folder of the itemInfo then
ProcessFolder(thisItem)
else
ProcessItem(thisItem)
end if
end repeat
on ProcessFolder(thisFolder)
set theseItems to list folder thisFolder without invisibles
repeat with i from 1 to count of theseItems
set thisItem to alias ((thisFolder as text) & (item i of theseItems))
set the itemInfo to info for thisItem
if folder of the itemInfo is true then
ProcessFolder(thisItem)
else
processItem(thisItem)
end if
end repeat
end ProcessFolder
on ProcessItem(thisalias)
-- do whatever...
end processItem