Re: Count files
Re: Count files
- Subject: Re: Count files
- From: "Marc K. Myers" <email@hidden>
- Date: Tue, 13 Aug 2002 15:59:19 -0400
- Organization: [very little]
>
Date: Tue, 13 Aug 2002 08:39:20 +0200
>
Subject: Count files
>
From: Peter Mathiessen <email@hidden>
>
To: AppleScript-Users <email@hidden>
>
>
Hi all,
>
>
I am in need of a script that renames the files in a folder.
>
>
Today I am using a random number, but a neat solution would be to use a
>
counter of some sort.
>
>
If the folder contains 3 files, the filename would be:
>
001.doc
>
002.doc
>
003.doc
>
>
Anyone?
>
>
get random number from 1000 to 3000
>
set x to result
>
set search_for_file to alias (the_vol & "Documents:")
>
set myListforfile to list folder search_for_file without invisibles
>
repeat with myFilename in myListforfile
>
set myfile to alias (the_vol & "Documents:" & myFilename)
>
end repeat
>
tell application "Finder"
>
set name of myfile to (x as string) & ".doc"
>
end tell
set chgFldr to (choose folder)
tell application "Finder" to set chgFiles to files of chgFldr
set fileCnt to count chgFiles
set numLng to (count (fileCnt as text)) * -1
if numLng > -3 then set numLng to -3
repeat with i from 1 to fileCnt
set fileName to (text numLng thru -1 of ((10000000 + i) as text)) & ".doc"
tell application "Finder" to set name of (item i of chgFiles) to fileName
end repeat
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[8/13/02 3:59:05 PM]
_______________________________________________
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.