Hi Folks-
I’m trying to write a script that will search through a bunch of subfolders, pull out all PDFs and duplicate them somewhere else. I also later want to note those folders that do not have any PDFs in them, but I’m having trouble getting the first bit to work! InTest has 2 subfolders.
I tried it both with the ‘cp’ line command and the duplicate command. Neither works.
tell application "Finder"
set rootin to "MrComputer:Users:a351958:Desktop:InTest:"
set rootout to "MrComputer:Users:a351958:Desktop:Outtest:"
set FolderList to get the name of every folder of (rootin as alias)
repeat with thisfolder in FolderList
set subfolder to rootin & thisfolder
set pdflist to (every file of entire contents of (subfolder as alias) whose name ends with ".pdf")
repeat with thispdf in pdflist
set pdfname to (thispdf as alias)
set pdfname to name of pdfname
set pdfin to rootin & pdfname
set pdfin to POSIX path of pdfin
set pdfout to rootout & pdfname
set pdfout to POSIX path of pdfout
do shell script "cp " & quoted form of pdfin & " " & quoted form of pdfout
end repeat
end repeat
end tell
gives the error
"no such file or directory
while
tell application "Finder"
set rootin to "MrComputer:Users:a351958:Desktop:InTest:"
set rootout to "MrComputer:Users:a351958:Desktop:Outtest:"
set FolderList to get the name of every folder of (rootin as alias)
repeat with thisfolder in FolderList
set pdflist to (every file of entire contents of thisfolder whose name ends with ".pdf")
repeat with thispdf in pdflist
duplicate file thispdf to folder rootout
end repeat
end repeat
end tell
gives
can't get entire contents of subfolder 1
thanks for your help.
-Ralph