Posted by
Herbie on
May 06, 2016; 3:18pm
URL: http://imagej.273.s1.nabble.com/macro-rename-files-simple-tp5016330p5016336.html
Inesica,
I assumed that you could do the batch processing yourself by using the
appropriate ImageJ-macro functions. The macro language is really easy!
This macro works for me:
//----------------------------------------------------
setBatchMode( true );
m = -4;
dirPath = getDirectory( "Choose a Directory" );
nameArray = getFileList( dirPath );
for ( i = 0; i < nameArray.length; i++ ) {
number = parseInt( substring( nameArray[i], 1, 5 ) );
number += m;
name = "z" + IJ.pad( number, 4 ) + "_t0000.tif";
status = File.rename( dirPath + nameArray[i], dirPath + name );
if ( status == false ) { exit( "Could not rename" ); }
}
setBatchMode( false );
//----------------------------------------------------
Hope you are well-served
Herbie
:::::::::::::::::::::::::::::::::::::
Am 06.05.16 um 15:46 schrieb inesica:
Sent from the ImageJ mailing list archive at Nabble.com.
>
> -- ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html