Posted by
G. Esteban Fernandez on
URL: http://imagej.273.s1.nabble.com/Renaming-files-tp5023166p5023171.html
Hi Nathalie,
Herbie's solution is great! Much easier than what I would've done :-)
Just add an extension, like .tif, if your files have one. I'll add
functionality for all files in a folder and add an extension (change the
.tif if your files have a different extension):
folder = getDirectory("Choose a folder to rename files");
files = getFileList(folder);
for(i = 0; i < files.length; i++){
nameSplit = split(files[i], "Z");
newFilename = nameSplit[0] + "_Z" + nameSplit[1] + "_t00Z.tif";
File.rename(folder + files[i], folder + newFilename);
}
-Esteban
On Sun, Apr 5, 2020 at 4:56 AM Herbie <
[hidden email]> wrote:
> Good day Nathalie,
>
> concerning labels of type
>
> //
> str = "C00XZ00Y";
> //
> // the following two lines of ImageJ macro code will do
> //
> a = split( str, "Z" );
> str = a[0] + "_Z" + a[1] + "_t00Z";
> //
> print( str );
> exit();
>
> Please try to understand what happen according to these two line by
> studying:
> <
https://imagej.nih.gov/ij/developer/macro/functions.html>
>
> I didn't have a look at the provided link.
>
> Regards
>
> Herbie
>
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::
>
> Houssin, Nathalie Samantha Laetitia wrote
> > Hello,
> >
> > I hope everyone is safe and coping with the sanitary situation.
> > I am trying to rename batch of files and have not been able to come up
> > with a solution not too time consuming
> > My files are labeled with C00XZ00Y and I would like to put a string in
> > between as well as add the suffix _t00Z
> > so that it would look like C00X_Z00Y_t00Z
> > My stacks are comprised of 25 to 40 images with 3 channels
> > Thank you for any help you can provide with this
> >
> > Bests,
> >
> > Nathalie
> >
> > Here is a link if you want to see the filenames
> >
>
https://www.dropbox.com/sh/4qc2e1qyq1b4vr8/AAC9kPzGvFXE-8rzN5eD95Epa?dl=0> >
> >
> > Nathalie HOUSSIN, PhD
> > Ohio State University - College of Optometry
> > Plageman's Lab
> > Fry Hall room 341c
> > 338 W 10th avenue
> > Columbus, Ohio 43210
> > Tel: 614-292-3346
> >
> > --
> > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
>
>
>
>
> --
> Sent from:
http://imagej.1557.x6.nabble.com/>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html