script to delete .html files from a folder
script to delete .html files from a folder
- Subject: script to delete .html files from a folder
- From: Roger Donaghy <email@hidden>
- Date: Fri, 5 Nov 2004 11:08:50 -0500
Hello, I'm fairly green in regards to Applescript and right now, I'm
trying to write a script that would delete all .html files from a
specific directory. After reading through documentation and
tutorials, I've cobbled together the following script:
tell application "Finder"
set thePath to (startup disk as text) &
"Users:rdonaghy:Documents:testScript:"
set theCount to count of items in thePath
if theCount > 0 then
repeat with i from 1 to theCount
set theFileName to item i in folder thePath
set theFileNameText to the name of theFileName as text
if the name extension of theFileName is equal
to "html" then
move file theFileNameText in folder
thePath to trash
end if
end repeat
end if
end tell
This script compiles without a problem, but when I run it, I get the
following error:
Finder got an error: Can't get item 3 of folder "Macintosh
HD:Users:rdonaghy:Documents:testScript:".
Does anyone know the cause of this error? Any help would be greatly
appreciated.
Thanks,
Roger
--
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden