Claudio Herrera
asked on
Expert Qlemo or others Expert How do I move C:\Windows\$NtUninstall to another folder using a batch file?
I have this batch file without the /MOVE option, I would like to include it in order to move the target folder, and their contain files
In order words
I need a code WHICH
MOVE WITH the criteria to "all folders C:\Windows\$*, but not $hf_mig$" AND their contents of each folders TO C:\Backup\NtUninstall\
IF all folders FROM C:\Windows\$*, but not $hf_mig$" AND their contents (are) MOVE TO C:\Backup\NtUninstall\ I will NOT have to have at C:\Windows\ any folder that start WITH "$" except the folder $hf_mig$ and the folder's contains of the MOVEd TO C:\Backup\NtUninstall\
In order words
I need a code WHICH
MOVE WITH the criteria to "all folders C:\Windows\$*, but not $hf_mig$" AND their contents of each folders TO C:\Backup\NtUninstall\
IF all folders FROM C:\Windows\$*, but not $hf_mig$" AND their contents (are) MOVE TO C:\Backup\NtUninstall\ I will NOT have to have at C:\Windows\ any folder that start WITH "$" except the folder $hf_mig$ and the folder's contains of the MOVEd TO C:\Backup\NtUninstall\
@ECHO OFF
pushd %SystemRoot%
for /F "tokens=*" %%D in ('dir $* /b /a:d ^| find /v "$hf_mig$" ') do (
md C:\Backup\NTUninstall\%%~nxD 2>nul
robocopy "%%~D\" "C:\Backup\NtUninstall\%%~nxD" /MOVE
rd "%%~D" 2>nul
)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much