Hi Claus this is exactly what I needed...10 kudos.
Best Regards, Philipp Am Mo., 27. Sept. 2021 um 21:01 Uhr schrieb Claus Futtrup < [email protected]>: > Hi Philipp > > To extend on the proposal by Denis, for Windows there is the DOS commands, > like: > > DIR /S /B path\*.txt > result.lst > > It will traverse all subdirectories and with the pipe generate a text file > with the result (replace 'path' with your real-name parent folder path). > The result.lst contains a list of all files (one per line) with their > complete file-path-names. > > Best regards, > Claus > > On 27-09-2021 20:37, P M wrote: > > @ Denis: > - I forgot to mention: The files are under windows. > > @ Claus: > - [...] I create a list of all files in that directory and read all of > them [....] > > Yes , this is what I see when using "listfiles" > What I am searching for would be: > - choose a directory > - choose a file extension > > --> create a list of all files with that extension in : > -> the directory > -> in all sub-directories > > I do doubt that there is a ready-to-use-function for that, so my question > is: How to do it the most elegant way? > > I do not have a full aproach for this, yet. > However I feel, that the first thing to do is, to get absolut pathnames to > all folders, > Afterwards I would scan each folder for the specifi file type. > > > Mh...still thinking. > Philipp > > > > > > > Am Mo., 27. Sept. 2021 um 17:52 Uhr schrieb Claus Futtrup < > [email protected]>: > >> Hi Philipp >> >> This piece of code used to work (haven't checked with Scilab 6.1.1). >> First I ask the user to select one file in the directory, then I create a >> list of all files in that directory and read all of them: >> >> [units,typs,nams]=file(); // nams(1) = script file name incl. >> pathfpathname=strsplit(nams(1), [filesep()]);scriptpath = >> get_absolute_file_path(fpathname($)); >> printf("Please select a .txt measurement file\n");[filetoread pathtofile] = >> uigetfile("*.txt",scriptpath,"Choose measurement file"); >> // For a start, assume script file is in the same directory as the data, >> // but don't be sure, read pathtofile and use it instead.readfile = >> pathtofile + "\" + filetoread;if length(filetoread)>4 then // one char + >> .txt expected, i.e. length>4 >> // If user doesn't select any file, the above check prevents a crash >> chdir(pathtofile); >> if verbose then printf(" MSG: File found, thanks!\n"); end >> >> ... >> >> // Analyze - find all files in the path, who's filename is an// integer, >> which means - we expect it to be an angle.filelist=listfiles(pathtofile + >> "\*.txt"); >> >> >> ... >> >> imax=max(size(filelist)); >> >> ... >> >> printf("Loop %i times: ",imax);for i=1:imax do >> printf("%i ",i) // Show progress >> [path fname extension] = fileparts(filelist(i)); >> if isnum(fname) then // check if fname (a string) contains >> d=evstr(fname); // a number, and convert to number >> >> >> I hope this is inspiring. >> >> Cheers, >> Claus >> >> On 27-09-2021 16:50, P M wrote: >> >> Dear All, >> >> I need to find and list all files of a specific type on my hard >> drive....How to do that in the most elegant way? >> >> E.g.: >> >> - find all *.txt files in "D:\" >> - also find all '*.txt' files in each sub - directory, sub-sub-directory, >> ..etc >> - create a list that stores the absolute path names to the *.txt files. >> >> I am aware of >> - dir >> - findfiles >> - listfiles >> - ls >> >> But they only seem to list the files in a dedicated folder. >> >> Is there a function, that also searches all sub-folders automatically? >> >> Thank you, >> Philipp >> >> >> >> >> _______________________________________________ >> users mailing >> [email protected]http://lists.scilab.org/mailman/listinfo/users >> >> >> _______________________________________________ >> users mailing list >> [email protected] >> http://lists.scilab.org/mailman/listinfo/users >> > > _______________________________________________ > users mailing > [email protected]http://lists.scilab.org/mailman/listinfo/users > > > _______________________________________________ > users mailing list > [email protected] > http://lists.scilab.org/mailman/listinfo/users >
_______________________________________________ users mailing list [email protected] http://lists.scilab.org/mailman/listinfo/users
