list directory + files to txt file

  • Thread starter Thread starter Bob G
  • Start date Start date
B

Bob G

I used to have a Dosprompt command (in Windows 2000 or Windows XP) to list
the contents of a directory and it's files to a textfile in the following
format

N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1050 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1070 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1200 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2000 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2301 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2305 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2335 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2340 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2345 FR.pdf

I need the full pathname AND the file. I have to import this file in Excel
and separate the data by the backslash.

Strangely enough, I don't remember the command or it's options.
I should think it is something like dir > list.txt, but then I don't have
the full pathname.

Can anyone help me with this?

Kind regards,

Bob
 
Bob said:
I used to have a Dosprompt command (in Windows 2000 or Windows XP) to list
the contents of a directory and it's files to a textfile in the following
format

N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1050 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1070 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1200 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2000 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2301 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2305 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2335 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2340 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2345 FR.pdf

I need the full pathname AND the file. I have to import this file in Excel
and separate the data by the backslash.

Strangely enough, I don't remember the command or it's options.
I should think it is something like dir > list.txt, but then I don't have
the full pathname.

Can anyone help me with this?

Kind regards,

Bob

From the CMD prompt:

for %a in (*.*) do @echo %~fa>>textfile.txt
 
Phil Robyn said:
From the CMD prompt:

for %a in (*.*) do @echo %~fa>>textfile.txt

--
Phil Robyn
Univ. of California, Berkeley

u n z i p m y a d d r e s s t o s e n d e - m a i l

This already works fine, but can the files in subdirectories also been
shown?
for example, i am in the N:\General\TECHNICAL DOCUMENTATION\GETRA
MARKING\MSDS\ directory
then the result should be :
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1050 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1070 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1200 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2000 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\NL\16-1050 NL.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\NL\16-1070 NL.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\NL\16-1200 NL.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\NL\16-2000 NL.pdf

Although I am pretty sure, i had a command that showed me the
fullpath+filename of all the subdirectories, this works for me too.

Bob
 
dir *.* /s /b

thank that'll do it?


Bob G said:
This already works fine, but can the files in subdirectories also been
shown?
for example, i am in the N:\General\TECHNICAL DOCUMENTATION\GETRA
MARKING\MSDS\ directory
then the result should be :
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1050 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1070 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1200 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2000 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\NL\16-1050 NL.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\NL\16-1070 NL.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\NL\16-1200 NL.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\NL\16-2000 NL.pdf

Although I am pretty sure, i had a command that showed me the
fullpath+filename of all the subdirectories, this works for me too.

Bob
 
I used to have a Dosprompt command (in Windows 2000 or Windows XP) to list
the contents of a directory and it's files to a textfile in the following
format

Aside from alt.msdos being the wrong group, a more
apropriate, though dealing in batch files:

N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1050 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1070 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-1200 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2000 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2301 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2305 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2335 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2340 FR.pdf
N:\General\TECHNICAL DOCUMENTATION\GETRA MARKING\MSDS\FR\16-2345 FR.pdf

I need the full pathname AND the file. I have to import this file in Excel
and separate the data by the backslash.

Strangely enough, I don't remember the command or it's options.
I should think it is something like dir > list.txt, but then I don't have
the full pathname.

Once you navigate to the folder:

DIR /b >FileOut.txt

Mind you, I don't have XP, rather 98SE, but it's my
guess that it probably hasn't changed much. I'd do a
Help query on DIR: DIR /? or possibly DIR -?.

--

Sincerely, | NOTE: Best viewed in a fixed pitch font.
| (©) (©)
A. H. Carter | ------ooo--(_)--ooo------
d(-_-)b | /// \\\ |
/// \\\
 
Back
Top