Login  Register

Re: renaming files

Posted by Citron, Bruce on Jun 07, 2008; 6:30pm
URL: http://imagej.273.s1.nabble.com/renaming-files-tp3696004p3696005.html

See if A Better Finder Rename meets your needs.
http://www.publicspace.net/ABetterFinderRename
I¹ve been using it for years and it amazes me how easy it is to use and how
well it works.
-Bruce
Bruce A. Citron, Ph.D., Dir., Lab of Molecular Biology,  Bay Pines VA
Healthcare System, Res. & Dev. 151



On 6/6/08 12:50 , "William O'Connell" <[hidden email]> wrote:

>
>  This is a bit off-topic,  but I wonder if anyone has experience using the
> File.renameTo command. T'll typically be renaming 20 or so files at a time.
> Maybe 80% of renames will be successful. Multiple attempts will not change
> the outcome. For a particular file, either the rename will succeed or it
> won't.  Renames that fail are usually for files of several megabytes, large
> by my standards. Here's some of the code:
>
>             FileInfo fi = imp.getOriginalFileInfo();
>             String oldName = fi.directory + fi.fileName;
>             File oldFile = new File(oldName);
> .....
>             String title = patientID + sep + view + sep + acqDate;
>             String newName = fi.directory + title + selected_file_ext;
>                boolean renamed = oldFile.renameTo(new File(newName));
>                IJ.wait(100);
>                if(!renamed)
>                IJ.log(oldFile.getName() + " ==> " + title + ": renamed? = "
> + renamed);