renaming files

Jim Ault JimAultWins at yahoo.com
Wed Feb 4 10:45:16 EST 2009


Use the rename command, but you need to be careful.

You should do a few checks as you go, such as


if there is a file (tFullPathName) then
   rename tFullPathName to tNewFullPathName
   wait 20 milliseconds --for the hard drive task to finish
   if there is not a file (tNewFullPathName) then
     get "Ooops, the renaming could not be done as normal."
     get it & cr & "Check permissions or naming rules, or other"
     get it & cr & "original = " & tFullPathName
     get it & cr & "new name = " & tNewFullPathName
     answer it
   end if
end if

If you are using a networked drive that has longer latency, increase the 20
milliseconds to 50 or more, and keep testing to find the most successful
timing.

Finding a file usually involves recursion (such as WalkFolders) with a
specific starting point rather than the entire hard drive.  On a Mac you
could use Applescript to tell the Finder to run a Spotlight search and then
deal with the resulting list of found files and folders. You need to be
specific about the find operation you want to do.

Hope this helps.

Jim Ault
Las Vegas

On 2/4/09 1:05 AM, "Nicolas Cueto" <niconiko at gmail.com> wrote:

> Hello All,
> 
> Being somewhat lazy here.
> 
> What Rev commands would I use for
> finding a specific local file and then
> renaming that file?
> 
> For example, Rev finds file:
> 
> C:/FolderName/dog.jpg
> 
> and then renames it as:
> 
> C:/FolderName/001.jpg
> 
> 
> Thanks.
> 
> --
> Nicolas Cueto
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list