Re: Check for a space at the end of a filename?
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.