yes i dont know wat oba wants accomplished here
In this code, he is looking into the folder
F:\sqldata\MSSQL\BACKUP\master\ and all of its subfolders, and copying any .BAK file that may be there to the folder
C:\master.
He is making dir sort its output in reverse date order, why, I do not know.
for /f "tokens=* delims=" %%i in ('dir /o:-d /s /b F:\sqldata\MSSQL\BACKUP\master\*.BAK') do (
copy %%i "\\C:\master"
goto endmstr1
)
:endmstr1
Here, he is deleting every file in every subdirectory below the directory
Z:\master\. This time the dir output is sorted in date order, again, I do not know why.
for /f "tokens=* delims=" %%i in ('dir /o:d /s /b Z:\master\*.*') do (
del %%i
goto endmstr2
)
:endmstr2
His eccentric use of labels is intriguing.
These 2 pieces are exactly equivalent to the above quoted code sections.
for /f "tokens=* delims=" %%i in ('dir /o:-d /s /b F:\sqldata\MSSQL\BACKUP\master\*.BAK') do copy %%i "\\C:\master"
for /f "tokens=* delims=" %%i in ('dir /o:d /s /b Z:\master\*.*') do del %%i