Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Copy directory tree without repeating directory name

Did you vote for it on the feedback forum?
Of course!

I even got bit in the buttocks yesterday with another example of why it is needed. I'm working on reorganizing some directories in preparation for documentation conversions. This BTM was to be run in a folder containing many documents each in its own folder.
Code:
@echo off
do d in /a:d *.*
    md 1_Original
    move /s "%d\*.*" 1_Original
    move /s 1_Original "%d"
    md "%d\2_Unstructured"
    md "%d\3_Structured"
    md "%d\4_Delivery"
    md "%d\5_XML"
enddo
Or even with less file moving using a rename
Code:
@echo off
do d in /a:d *.*
    ren "%d" 1_Original
    md "%d"
    move /s 1_Original "%d"
    md "%d\2_Unstructured"
    md "%d\3_Structured"
    md "%d\4_Delivery"
    md "%d\5_XML"
enddo
Yeah... now that I reread it, it's going to have to use a temp dir...
Code:
@echo off
md tempdir
do d in /a:d *.*
    move /s "%d\*.*" tempdir
    md "%d\1_Original"
    move /s "tempdir\*.*" "%d\1_Original"
    md "%d\2_Unstructured"
    md "%d\3_Structured"
    md "%d\4_Delivery"
    md "%d\5_XML"
enddo
rd tempdir
I just find the first two more elegant.
 
Wouldn't

do d in /a:d *
...

work as well? even if it will only save 2 keystrokes?
----- Original Message -----
From: JohnQSmith
To: [email protected]
Sent: Tuesday, March 22, 2011 05:20 PM
Subject: RE: [Support-t-2442] Re: Copy directory tree without repeating directory name


Quote:
Originally Posted by David Marcus
Did you vote for it on the feedback forum?

Of course!

I even got bit in the buttocks yesterday with another example of why it is needed. I'm working on reorganizing some directories in preparation for documentation conversions. This BTM was to be run in a folder containing many documents each in its own folder. Needless to say... back to the drawing board.

Code:
@echo off
do d in /a:d *.*
md 1_Original
move /s "%d\*.*" 1_Original
move /s 1_Original "%d"
md "%d\2_Unstructured"
md "%d\3_Structured"
md "%d\4_Delivery"
md "%d\5_XML"
enddo
 

Similar threads

Replies
7
Views
2K
Back
Top