• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
script to delete .html files from a folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: script to delete .html files from a folder
      • From: Michelle Steiner <email@hidden>
    • Re: script to delete .html files from a folder
      • From: "Adam K. Wuellner" <email@hidden>
    • Re: script to delete .html files from a folder
      • From: "Adam K. Wuellner" <email@hidden>
  • Prev by Date: Re: Quark Book [was New Comprehensive AppleScript Book]
  • Next by Date: Re: script to delete .html files from a folder
  • Previous by thread: Re: Quark Book [was New Comprehensive AppleScript Book]
  • Next by thread: Re: script to delete .html files from a folder
  • Index(es):
    • Date
    • Thread