Re: change case script
Re: change case script
- Subject: Re: change case script
- From: Arthur J Knapp <email@hidden>
- Date: Fri, 02 Nov 2001 18:33:43 -0500
>
Date: Fri, 02 Nov 2001 12:47:40 +0000
>
Subject: change case script
>
From: jake williamson 28 <email@hidden>
>
is it possible to compile a script that takes all the file names in a folder
>
and coverts them to lower case and replaces a space with an underscore??
>
Wild About Elephants.jpg
>
wild_about_elephants.jpg
>
can this be done???
I'm fairly certain that this has never been done before... ;-)
set theFolder to (choose folder)
tell application "Finder"
set the_files to every file of theFolder
set AppleScript's text item delimiters to ":" -- files only, not folders
set the_names to name of every file of theFolder as string
end tell
set upperC to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set lowerC to "abcdefghijklmnopqrstuvwxyz"
repeat with x from 1 to 26
if (the_names contains upperC's item x) then
set text item delimiters to upperC's item x
set the_names to the_names's text items
set text item delimiters to lowerC's item x
set the_names to "" & the_names
end if
end repeat
set text item delimiters to "_"
set the_names to the_names's text items
set text item delimiters to space
set the_names to "" & the_names
set text item delimiters to ":"
set the_names to the_names's text items
tell application "Finder"
repeat with x from 1 to the_files's length
set (the_files's item x)'s name to the_names's item x
end repeat
end tell
set text item delimiters to {""}
beep 1
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.zavatone.com/