Link to home
Start Free TrialLog in
Avatar of jpvhack
jpvhack

asked on

Listing a files/Directories , but i would want in one row

I'm trying listing a directory, but i would want output in one row. could any give me a hand?.

Actually:
dir c:\ /ad /b /-p /o:gen
file1
file2
file2
.
but i want this output: file1 file2 file3....

Thanks in advance
Avatar of Brainarts
Brainarts

The only way i see to make it is to Output the listing to a file

dir c:\ /ad /b /-p /o:gen > listing.txt

Then Reprocess the file with vba script or any other script to replace the  CRLF line terminator with the file separator you need for example :" ,"

This can be automated very easyly
If you need to do this for once, do this:

1. dump the out to a text file by appending  "> output.txt" to you dir command.
e.g. dir /b > output.txt

2. Open the file in MS word. Goto find and replace. Replace ^p with a blank/space.

If you need to do it repeatedly - thats another story.

Avatar of jpvhack

ASKER

It should carry out in a file, in only batch file, or vb script file.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial