This can be done with pretty easy syntax in IDL. Here is an approach I demonstrate, where we assume that all the files you want are in a directory tree rooted at "C:\My Project\My Data\" and they all have the format that they start with a prefix "myproj_" and have a ".dat" extension.
; Get the files into an IDL string array
targetFiles = file_search('C:\My Project\My Data\', 'myproj_*.dat')
print, n_elements(targetFiles) ; Prints the count of files found, if you are curious
openw, lun, 'C:\My Project\MyFileList.txt', /GET_LUN
printf, lun, targetFiles, FORMAT='(A)' ; print the entire array, one element to a line
free_lun, lun ; close the file
That's it!
James Jones
|