I want to copy these files into a folder 4 levels up and delete the extraneous folders. The manual approach seems doable, yet two hours later I found myself with ¼ way through. These directories number in the hundreds.
Then I thought a batch file could simplify the solution. But I only have fundamental experience with batch files. Please let me know if anyone could provide me with some assistance and lead me in the right direction.
How do you move multiple files with different file extensions (like *.doc, *.txt, *.htm)? How do you count the number of child directories so the batch file moves the files up to the parent folder? How do you search recursive folders in a directory?
For illustration purposes, the folder hiearchy follows below. I need to get all text, html, and doc files from ArchiveNameAgain into ArchiveName. I need a batch file since the scenario exist for a couple hundred archive folders.
uncompressing\ArchiveName\UnZipArchive\UnRAR\ArchiveNameAgain\files.txt, file.htm
Here’s my starting point.
@ECHO ON
REM This batch file should search for recursive directory and extract the files from the last
REM final folder level; and move the files a specific number of folders up.
F:
CD Uncompressing\
:AGAIN
ECHO MOVING %1
MOVE %1\%1\*.*
REM DELTREE /Y %1
SHIFT
IF NOT "%1" == "" GOTO AGAIN
ECHO
This post has been edited by robert_neville: 22 August 2005 - 04:11 PM



Help
Back to top









