Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a CSV/Word file from disk directory 1

Status
Not open for further replies.

deevaetodin

Technical User
Jun 22, 2001
80
US

Is there a way so that I can create a delimted file from a disk directory.

What I want to do is catalogue several hundred data disks whereby I only have their subsequent directory for file content reference.

Can I cut and paste a directory into an excel or word file. Excel would be preferred as it will end up in an Access table.

Any help would greatly be appreciated.
 
Exit to a dos prompt.

C:\>

Using DOS commands, go to the folder you're wanting to get.

cd mydire~1 (where the foldername is mydirectory and has more than 8 letters)

At that prompt:

C:\mydire~1>

Type the following:

prn dir /s ltp1:

and hit enter. It means print this directory with all subdirectories to lpt1 (your printer).

I'm pretty sure that's the right syntax. Here's what it's based on:

PRINT [/B:(buffersize)] [/D:(device)] [/M:(maxtick)] [/Q:(value] [/S:(timeslice)][/U:(busytick)] [/C][/P][/T] [d:][path][filename] [...]

I'm sure someone will correct my syntax if it's wrong! Brainbench MVP for Microsoft Word
techsupportgirl@home.com
 
I do not know whether what Dreamboat suggests is correct, but you could try this:

1. Exit to DOS (command)
2. Type the following form which ever directory you want to catalogue:

dir /s > FILENAME.txt

3. This will perform a directory listing (including sub directories) and put the contents into the file you specify.

4. In Excel, open the txt file you created and follow the prompts to translate a text file into something Excel can understand. You can either use "delimited" or "fixed width" structures. The top of each page printed by the "dir /s" command is a mess, which you will probably want to delete, but the rest of it is the directory listing.

 

That's great guys.

I figured I would need to do a little clean up but it this saves a tonne of data entry.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top