• 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
Re: Check for a space at the end of a filename?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Check for a space at the end of a filename?


  • Subject: Re: Check for a space at the end of a filename?
  • From: Timothy Bates <email@hidden>
  • Date: Tue, 19 Mar 2002 09:49:31 +1100

On 19/3/02 8:06 AM, "Charles Heizer" <email@hidden> wrote:
> I want to look at all the fines in a dir and if any have a
> space at the end, tell me which ones and remove the space.

This will get you going, but beware of things like extensions and displayed
names versus full names under OS-X

on open of folderList
repeat with aFolder in folderList
ProcessAFolder(contents of aFolder)
end repeat
end open

on run -- Run handler. Prompt the user for a folder to process.
set theFolder to choose folder
my ProcessAFolder(theFolder)
end run

on ProcessAFolder(aFolder)
tell application "Finder"
set theFiles to every file of aFolder
repeat with afile in theFiles
set theOriginalName to name of afile
if character -1 of theOriginalName is space then
set name of afile to (text 1 thru -2 of theOriginalName)
display dialog "altered file " & theOriginalName
end if
end repeat
end tell
end ProcessAFolder
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Check for a space at the end of a filename? (From: Charles Heizer <email@hidden>)

  • Prev by Date: Re: Applescript partitioning?
  • Next by Date: Re: Open files
  • Previous by thread: Check for a space at the end of a filename?
  • Next by thread: Set value of FileMaker container?
  • Index(es):
    • Date
    • Thread