Code:
@echo ON
SET "dir=f:\uncompressing"
SET "ext=*.doc *.txt *.htm"
FOR /r "%dir%" %%* IN (%ext%) DO (
MOVE "%%*" "%%~dp*..\..\")
FOR
* Used to repeat a command on a group of files / drives.
* SYNTAX -:
o FOR /r "%dir%" %%* IN (%ext%) DO (
echo ^
move "%%*" "%%~dp*..\..\")
+ WHERE :
# %%* is a variable name
# (%ext%) is a group of files
# move is a command that is to be repeated for each member of list.
I am almost there with this batch file. It does the job, yet could use additional modifications. Upon activating the batch file, it runs through the recursive directories; identifies the files; and moves them up two levels. The issue occurs in the folders where I already manually performed these tasks. The batch file moves these files outside the "uncompressing" folder and creates a mess. I could try and separate these folders; but will miss a few.
I wonder if it possible to include the following functionality. If these text files are four levels deep, move them up three levels; if three levels exist, move them up two levels; if two levels exist move them up one level; if one level exist don't move anything.
I need the files to end up in the Archive folder (different names for each archive); NOT the uncompressed folder; not the root dirve. Let me know if anything is possible.
f:\uncompressing\Archive\document.txt
f:\uncompressing\Archive\Unzip\document.txt
f:\uncompressing\Archive\Unzip\UnRAR\document.txt