I'm trying to combine two FOR loops into one.
Here is my code :
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set BackupDest=D:\backup
for /D %%I in ("%HomeDrive%\users\*") do if exist "%BackupDest%\%%~nI\" (
xcopy "%HomeDrive%\users\%%~nI\Desktop" "%BackupDest%\%%~nI\Desktop\" /e /i /y
xcopy "%HomeDrive%\users\%%~nI\Documents" "%BackupDest%\%%~nI\Documents\" /e /i /y
)
for /f "tokens=*" %%I in ('dir /a:d-h /b "%HomeDrive%\users\*" ^| findstr /b /e /i /l /v /g:"%~dp0\bin\exclude_users.txt"') do if not exist "%BackupDest%\%%~nI\" (
echo Destination folder of the user %%~nI is missing
)
I'm note sure if we can do that in this case ?
If yes, how I can achieve this ?
Any help is greatly helpful.
Aucun commentaire:
Enregistrer un commentaire