[OFF] utility for files

Ruslan Zasukhin sunshine at public.kherson.ua
Sat Feb 15 11:33:24 CST 2003


on 2/15/03 10:48 AM, David Hood at david.hood at stonebow.otago.ac.nz wrote:

Hi David,

>> Anybody know if exists such tool for MAcOS X which can do next task.
> 
> Applescript.

Okay, but what about more improvement?

In my dream I select in Finder, few files, choose in context menu special
item
        ChangePrefix
        AddPrefix
        ChangeSuffics
        AddSuffics

Get dialog with one or two edit field, enter what I want, and press OK.
Is this possible?

I feel that yes. :-)
Just don't know if AppleScript itself can be attached to context menu?

> As an example for changing names in all the files in a folder
> 
>> A) add prefix to many files.
> 
> set newPrefix to "old_"
> tell application "Finder"
> activate
> set theFolderIWant to choose folder
> set ListofDocuments to every document file of theFolderIWant
> repeat with aDocument in (ListofDocuments as list)
> set oldName to name of aDocument
> set name of aDocument to newPrefix & oldName
> end repeat
> end tell
> 
>> B) change prefix of files
> 
> Using OSX with the command line:
> 
> set oldPrefix to "old"
> set newPrefix to "FBL"
> tell application "Finder"
> activate
> set theFolderIWant to choose folder
> set ListofDocuments to every document file of theFolderIWant
> repeat with aDocument in (ListofDocuments as list)
> set oldName to name of aDocument
> set newname to (do shell script " echo " & oldName & "| sed
> s/" & oldPrefix & "/" & newPrefix & "/")
> set name of aDocument to newname
> end repeat
> end tell
> 
> Since the last example calls the unix shell it may need a bit of work on
> unusual characters that need escaping (but it worked fine on a test
> folder I tried it on. This version would also go wrong if the searched
> for string appears elsewhere in the filename.

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://listserv.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list