Opening files in folders with complex names with bioformat

Hi all,

I’m trying to open files using the following commands:

//INPUT/OUPUT folders
inDir=getDirectory("Choose the input folder"); 
outputDir=getDirectory("And the output folder");
myList=getFileList(inDir);  //an array


for (j = 0 ; j < myList.length ; j++ ) {
	
	if(endsWith(myList[j], ".lif")) {
		path=inDir+myList[j];   //path to each file
		run("Bio-Formats Macro Extensions");
		Ext.setId(path);
		Ext.getSeriesCount(seriesCount);
		print(seriesCount+" series in "+myList[j]);
		i=0;
		for (i=0; i<seriesCount; i++) {
			run("Bio-Formats Importer", "open="+path+" color_mode=Default view=Hyperstack stack_order=XYCZT series_"+(i));

This used to work without issue except that now I find if there is a single space somewhere in the path to the files -i.e. because the file is in a folder with a name like “my folder”- Bioformat looks for a folder named “my” and stops there. Is there a trick to resolve this issue?

I’m on a laptop using Win10 and the latest -updated- Fiji.

Matthieu

Hi @MatthieuV,

The trick is square brackets so that that the spaces are read through.

run("Bio-Formats Importer", "open=["+path+"] color_mode=Default view=Hyperstack stack_order=XYCZT series_"+(i));

1 Like