comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Writing each filename into new line of text file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Writing each filename into new line of text file [message #91071 is a reply to message #91070] Mon, 01 June 2015 00:30 Go to previous messageGo to previous message
Kai Heckel is currently offline  Kai Heckel
Messages: 51
Registered: April 2015
Member
Am Montag, 1. Juni 2015 09:24:23 UTC+2 schrieb Kai Heckel:
> Am Freitag, 29. Mai 2015 22:43:57 UTC+2 schrieb Dick Jackson:
>> On Friday, 29 May 2015 05:48:43 UTC-7, Kai Heckel wrote:
>>> Hey!
>>>
>>> I'd like to list my files and write them into a text file. Each filename should be in a separate line....
>>> Shouldn't be to hard ;)
>>>
>>> This is what I have:
>>>
>>> PRO test
>>> cd, 'Path of my files'
>>> files_all = FILE_SEARCH()
>>> openw,lun1,'fileinfo.txt', /get_lun
>>> printf, lun1, files_all, FORMAT='(A)'
>>> close, lun1
>>> free_lun,lun1
>>> END
>>>
>>> I couldn't find any suitable command till now...
>>>
>>> Thanks!
>>
>> As we often ask around here, "in what way is this not working for you?". When I run this, it does write every filename on a separate line, as expected. It also seems to be listing contained folders... is that the problem? If so, use this instead:
>>
>> files_all = FILE_SEARCH(/TEST_REGULAR)
>>
>> Bonus: if you're going to do "free_lun", you don't have to do "close"!
>>
>> Cheers,
>> -Dick
>>
>> Dick Jackson Software Consulting Inc.
>> Victoria, BC, Canada --- http://www.d-jackson.com
>
>
> Thank you very much for your solutions!
>
> @ Nikola:
> If I try your version it prints my datasets into 3 columns for some reason...
>
> @ Dick:
> "/TEST_REGULAR" returns an empty string (not an array as needed)
>
> I assume that it should be possible to reduce the number of columns in Nikolas version in some way.....isn't it?
>
> Thanks everyone!

Hey! Me again ;)

I found the solution it is, as always, surprisingly easy!
Replacing the format-argument "A" with "A0" worked out as desired.
Now every file is written to a new line!

Thanks for your help!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: NEWTON: Roundoff problem in lnsrch_d
Next Topic: Confused about image dimensions

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:07:01 PDT 2025

Total time taken to generate the page: 0.00481 seconds