X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 11 Apr 2007 09:29 AM by  anon
Is there any functions/routines to save many file names in a file...?
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
11 Apr 2007 09:29 AM
    Good day, everyone!!! I need to process about 1000 *.hdf files at once. I usually copied their names in DOS prompt and pasted it into UltraEdit and make a file like 'batch_mod07.txt' for example so far. Well, even though I am a beginner, it is not a recommendable way for a IDL programmer. Is there anyone who has any routines or functions for this?

    Deleted User



    New Member


    Posts:
    New Member


    --
    11 Apr 2007 09:29 AM
    Please don't mention Linux... I'm not good at Linux now. Let's discuss on the methods that we can use in windows.

    Deleted User



    New Member


    Posts:
    New Member


    --
    11 Apr 2007 09:29 AM
    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
    You are not authorized to post a reply.