asked on
ASKER
ASKER
ASKER
VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.
TRUSTED BY
@echo off
setlocal enabledelayedexpansion
set srcDir=C:\Master_folder
set destDir=J:\Master_folder
set cutoff=200501
pushd "%srcDir%"
for /f "tokens=*" %%a in ('dir /b /a-d /s 2^>NUL') do call :PROCESS "%%a" %%~ta
popd
goto :EOF
:PROCESS
call :GETDATEPARTS "%~2"
if not "%yy%%mm%"=="%cutoff%" goto :EOF
set rootName=%~1
set rootName=!rootName:%srcDir
echo Copying %~1 to %destDir%\%rootName%
echo F|xcopy "%~1" "%destDir%\%rootName%" >NUL
goto :EOF
:GETDATEPARTS
set dt=%~1
set tok=1-3
if "%dt:~0,1%" GTR "9" set tok=2-4
set yyyy=
for /f "tokens=%tok% delims=.:/-, " %%a in ('echo %~1') do (
for /f "skip=1 tokens=2-4 delims=/-,()." %%x in ('echo.^|date') do set %%x=%%a&set %%y=%%b&set %%z=%%c
)
if not "%yyyy%"=="" set yy=%yyyy%
if 1%yy% LSS 1000 (if %yy% LSS 70 (set yy=20%yy%) else (set yy=19%yy%))
if 1%mm% LSS 100 set mm=0%mm%
if 1%dd% LSS 100 set dd=0%dd%
goto :EOF
Good Luck,
Steve