469,950 Members | 1,487 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

creating custom text file from directory listing

I have a large collection of directories full of various files and am
looking to create custom text files for the contents of each
directory. Here is the situation:

The directories are named with a name and number, i.e. Smith1234567.
I am looking to create a text file named with the number portion of
the directory name (1234567.txt). The contents of the text file would
look similar to the following, where the "TIF" files at the end of
each line are the contents of each directory:

0001234567,Policy Archive,ARCHVE,\CUSTOMER\IMAGES\T10020402151414500 001.TIF
0001234567,Policy Archive,ARCHVE,\CUSTOMER\IMAGES\T10020402151414500 002.TIF
0001234567,Policy Archive,ARCHVE,\CUSTOMER\IMAGES\T10020402151414500 003.TIF
0001234567,Policy Archive,ARCHVE,\CUSTOMER\IMAGES\T10020402151414500 004.TIF
0001234567,Policy Archive,ARCHVE,\CUSTOMER\IMAGES\T10020402151414500 005.TIF

So basically, a text file containing 3 leading zeroes followed by the
number portion of the directory name, the text "Policy
Archive,ARCHVE,\CUSTOMER\IMAGES\" followed by the filename; one line
in the text file per file in the directory.

Obviously, my question is if and how it can be done.

Thanks in advance,
Gema
Jul 17 '05 #1
1 3762
Gema Gema <dc*****@hotmail.com> schreef in berichtnieuws
iq****************@newsread3.news.atl.earthlink.ne t...

Hello Gema,
I have a large collection of directories full of various files and am
looking to create custom text files for the contents of each
directory. Here is the situation:

The directories are named with a name and number, i.e. Smith1234567.
I am looking to create a text file named with the number portion of
the directory name (1234567.txt).
If the numeric portion of that name is fixed, the answer is to use a simple
RIGHT$( {string},LEN( {string} )- {fixed number} ) .

If not, two methods are available :
A) move back from the end until you find a non-numeric char (use MID$( ) for
this), move one stap back (to the last numeric char, and use MID$( ).
B) Move forward untill you find a numeric char, and use MID$( ) . This may
cause troubles if the "name" portion of the directory is something like
"123Smith1234567" or "smith123_1234567"

To append two strings together, use '&' : DirName$=right$( .... ) & ".txt"
The contents of the text file would
look similar to the following, where the "TIF" files at the end of
each line are the contents of each directory:
[Snip]
So basically, a text file containing 3 leading zeroes followed by the
number portion of the directory name, the text "Policy
Archive,ARCHVE,\CUSTOMER\IMAGES\" followed by the filename; one line
in the text file per file in the directory.
To write the retieved filenames to a file, use the the PRINT statement,
which can also write to a file. See "OPEN .... FOR OUTPUT as ...." for
that.
To retrieve the contents of a directory, use DIR$
Obviously, my question is if and how it can be done.


Hmmm ... I don't think can be done, and have no idea to how to do it :-)

Regards,
Rudy Wieser

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Thomas Philips | last post: by
2 posts views Thread by Jim | last post: by
3 posts views Thread by Stelrad Doulton | last post: by
11 posts views Thread by F. Michael Miller | last post: by
10 posts views Thread by Eric Lindsay | last post: by
4 posts views Thread by techusky | last post: by
Kelicula
3 posts views Thread by Kelicula | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.