Page 1 of 1

Manipulating Dos dir output

Posted: Fri Jun 27, 2008 4:10 pm
by ChugALug
Hello. I'm attempting to manage some dos dir outputs to go from this (sample) output:

C:\my dir\folder 1
File 1.txt 1,674,350 03/03/2006 3:15pm
File 2.txt 1,674,350 03/03/2006 3:15pm
File 4.txt 1,674,350 03/03/2006 3:15pm

3 files; 4,000,000 bytes

C:\my dir\folder 2
File 5.txt 1,674,350 03/03/2006 3:15pm
File 6.txt 1,674,350 03/03/2006 3:15pm

2 files; 4,000,000 bytes

To this output:

C:\my dir\folder 1 File 1.txt 1,674,350 03/03/2006 3:15pm
C:\my dir\folder 1 File 2.txt 1,674,350 03/03/2006 3:15pm
C:\my dir\folder 1 File 4.txt 1,674,350 03/03/2006 3:15pm

3 files; 4,000,000 bytes

C:\my dir\folder 2 File 5.txt 1,674,350 03/03/2006 3:15pm
C:\my dir\folder 2 File 6.txt 1,674,350 03/03/2006 3:15pm

2 files; 4,000,000 bytes

My attempt at a macro was to record macro1 which would just do a past and move to next line, and process on selection.

I then recorded macro2 which would find c:\my dir, go to end of line insert a tab, and copy whole line, and go to next line. I then searched for the next c:\my dir and extended selection and ran marco1.

When I do this while recording the macro it works. As soon as I run macro2 on its own nothing goes as it should.

Any help or suggestions would be appreciated.

Posted: Fri Jun 27, 2008 5:28 pm
by talleyrand
I don't have the time to mess with the regular expression. I suspect you'll run into issues with the fact that there will be line breaks.

As an alternative suggestion, do you need the file info? Would getting the fully qualified name of the files work for you? If so, try dir /b /s It will dump the following information.

C:\my dir\folder 1\File 1.txt
C:\my dir\folder 1\File 2.txt
C:\my dir\folder 1\File 4.txt
C:\my dir\folder 2\File 5.txt
C:\my dir\folder 2\File 6.txt

Posted: Fri Jul 04, 2008 1:59 pm
by ChugALug
Thanks for the input... I figured a way but had to use xls to get it complete.