I have a directory that has about 100 subfolders and close to 2,000 files within those subfolders (up to 4 layers). The files are .txt or .log, and each extension has a unique file name. I need to move or copy (whichever is faster) the files to the root of a different folder without recreating the subfolder structure like xcopy does. This is on Windows xp
Thanks in advance.
Existing:
Dir1\Folder1\000111.txt Dir1\Folder2\000112.txt Dir1\Folder3\000113.log Dir1\Folder4\Dir2\000114.txt Dir1\Folder4\Dir2\000115.txt Dir1\Folder4\Dir2\000116.log Dir1\Folder5\Dir3\000117.log Dir1\Folder5\Dir3\000118.txt Dir1\Folder5\Dir3\Dir4\000119.txt Dir1\Folder5\Dir3\Dir4\000120.txt Dir1\Folder5\Dir3\Dir4\000120.log
Required:
Dir9\000111.txt Dir9\000112.txt Dir9\000113.log Dir9\000114.txt Dir9\000115.txt Dir9\000116.log Dir9\000117.log Dir9\000118.txt Dir9\000119.txt Dir9\000120.txt Dir9\000120.log
How about something like:
Issue this with
dir1as your working directory.Have a read of
for /?to understand why this works.When I work on
forstatements I tend to try them out first like so: