473,396 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 3904
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Thomas Philips | last post by:
In the course of playing around with file input and output, I came across some behavior that is not quite intuitive. I created a simple text file, test.txt, which contains only 3 lines, and which I...
2
by: Jim | last post by:
I'm a little new to the C# way of doing thisgs... Although I've done this sort of thing before in VS 6 / MFC... creatnig controls, ActiveX controls, etc. Creating controls in MFC is pretty...
3
by: Stelrad Doulton | last post by:
Hi, I am having a strange problem on IIS 6.0. I am trying to create directories under a virtual directory on the fly to which I will upload files and retrieve these files later. I am having 2...
11
by: F. Michael Miller | last post by:
I'd like to copy the listing of a directory (& sub directories) to a text file in vb.net. I'm looking for teh equivilant of the DOS command dir /s > TargetFile.txt. Thanks!
10
by: Eric Lindsay | last post by:
This may be too far off topic, however I was looking at this page http://www.hixie.ch/advocacy/xhtml about XHTML problems by Ian Hickson. It is served as text/plain, according to Firefox...
5
by: Sam777 | last post by:
I was under the impression that creating the app_offline.htm file at the root of the webapp would cause all handles to be closed so that the app could be removed. Unfortunately, this isn't the...
1
by: Light | last post by:
Re, I'm having 2 problems with the Telerik trial controls. I'm using the latest release. I'm using 2005 studio and most of the controls show up properly in the designer but the RadMenu does...
4
by: techusky | last post by:
I have a *very* simple script written that displays the directory listing of the current working directory, but I am having some difficulty when I try to change folders. Basically, I have my $dir...
3
Kelicula
by: Kelicula | last post by:
This is NOT a complete OO perl tutorial However I thought it could be beneficial to explain some of the basic concepts, and allow some users to simplify the software design process. I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.