Hi,
I am looking forward a solution to get a list of folder in a given directory using JSL.
Thanks in advance!
Jerome
Something like this, perhaps?
Names Default To Here( 1 );
// Given a path to a folder, returns a list of all folders therein (not recursive!)
dirList =
Function({path}, {Default Local},
// Get all files and folders in the specified folder
fid = Files In Directory( path);
// Remove all the files, just leaving the folders
for(f=NItems(fid), f>=1, f--, if(IsFile(path||"/"||fid[f]), RemoveFrom(fid, f)));
fid;
);
// Try out the function
path = "$DESKTOP";
Print(dirList(path));
Something like this, perhaps?
Names Default To Here( 1 );
// Given a path to a folder, returns a list of all folders therein (not recursive!)
dirList =
Function({path}, {Default Local},
// Get all files and folders in the specified folder
fid = Files In Directory( path);
// Remove all the files, just leaving the folders
for(f=NItems(fid), f>=1, f--, if(IsFile(path||"/"||fid[f]), RemoveFrom(fid, f)));
fid;
);
// Try out the function
path = "$DESKTOP";
Print(dirList(path));
Indeed, something like this should help!
I will try to insert this in my script, but it should help me to go forward!
Thanks a lot Ian!
Jérôme
It works really well.