开发者

Copy the newest dir to a network drive

Dear all, I want to create a schedule job in windows which will copy the newest directory with its file to a specified net开发者_开发问答work path. I want fist to zip this dir and then to copy to the network path. SO under a specific directory a program creates a dir as follows: 0001, 0002, 003, etc. So I want the BAT file to take the last created one, zip it and copy it to the network drive \elias\cd1.

Thanks in advance


Please look here: windows bat script to compress and move files and skip step 4.

Only thing left to fit in, is to find the last subdirectory, which you can do as follows:

set dirtoprocess=
for /f "usebackq delims=" %%f in (`dir /b/o-d`) do if exist "%%~f\" (
    set dirtoprocess="%%~f"
    goto :OK
)
::UHOH, no directory found…
goto :EOF
:OK
::continue…
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜