Posted by
George Patterson on
Nov 04, 2013; 8:08pm
URL: http://imagej.273.s1.nabble.com/Select-every-other-image-and-move-into-specific-folder-tp5005416p5005445.html
Hi Rui,
Glad to hear it worked for you.
In that macro I intended variable "Data2" to designate each data set of
three images.
The variable "findDataSet" is a substring of each filename in which the
001, 002, or 003 are removed.
The if(findDataSet!=Data2) is to check if the filename belongs to a new
data set, "E8_002" for example. If not, a new directory is made with that
filename and the file is moved to that directory.
The Data2=findDataSet just before the }else{ sets the "Data2" variable to
the base filename designating that data set, "E8_002".
So now, the next time through the for loop if the next file is E8_002_002,
the findDataSet substring would again be "E8_002". Thus a new directory
would not be made and the file would simply be moved into the directory
made in the previous loop.
Now that I look at it again, I suggest one small change. It may never make
any difference but it shouldn't hurt either.
Change the
}else{
to
} else if (findDataSet==Data2){
As currently written it will move any files into that folder. If you've
other files with different names, those might all get moved into one of
your data set folders.
You might even add another bit to check that the files are images since
these are probably the only ones you want to move.
For instance, you could change
if (endsWith(list[i], "/")){
//listFiles(""+SubDirNames[0]+list[i]);
}else{
to
if (endsWith(list[i], ".tif")){
and get rid of the else part of the loop.
On Mon, Nov 4, 2013 at 1:48 PM, rtas <
[hidden email]> wrote:
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html