Reputation: 11
I need to delete the PDF files only from a folder on a network drive. There are other file types in the folder I can not touch. I am assuming I have to choose or identify the PF files first and then move them to the trash or delete them.
What I have so far:
tell application "Finder"
set theFolder to "Macintosh HD:Users:Kathlene:Desktop:ABC123_JOB"
set destFolder to "Server/JOBS/TRANSFER_TRASH/"
set thePDFs to every file of theFolder whose name extension is "pdf"
move thePDFs to destFolder
end tell
What I get for an error:
error "Can’t get every file of \"Macintosh HD:Users:Kathlene:Desktop:ABC123_JOB:\"." number -1728 from every file of "Macintosh HD:Users:Kathlene:Desktop:ABC123_JOB"
Upvotes: 1
Views: 1824
Reputation: 11238
Try:
tell application "Finder" to delete (files of folder "Macintosh HD:Users:Kathlene:Desktop:ABC123_JOB" whose name extension is "pdf")
Upvotes: 1