Question Locked

flatten file structure

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a drive of files that I want to move to another drive but only take the directory above the file.

For example:
C:\Documents and Settings\my documents\text.txt would copy over to my new drive as f:\my documents\text.txt
and
C:\Documents and Settins\desktop\new folder\text2.txt wold copy over as new folder\text2.txt.

Is there a way to do this with a script so that I won't have to click through multiple subdirectories to flatten my file structure?

Thanks in advance

3 replies

by dr dij

xxcopy util

is an enhanced third party version of xcopy.

has hundreds of options /switches, including, excluding files / extensions / patterns, timers, flattening, patterns, logs successful files, and/or/multiple logs copy errors, verification...

keeps long names

I use it to copy TB sized drives and backup my humongous media file directory structures to an external USB hard drive,

as windoze file explorer dies a nasty slow death (its head explodes with too many files) if I try to use visual tool like that.

by Member 25348569

Assuming your target disk is, say, T: and your source disk is S:

@for /D %i in ("S:\*.*") do @for /D %j in ("%~fi\*.*") do @xcopy "%~fj" "T:\%~nj" /S/E/I

This discussion is closed to new replies.