在Jenkins上配置批处理删除远程共享目录7天以上的文件

net use * /del /yes
NET USE X: \\10.29.48.12\shares\Test password /user:DOMAIN1\account
 
set AutoPath=X:\
%AutoPath:~0,2% 
pushd %AutoPath%
cd /d %AutoPath%

rem delete reports generated 7 days ago
forfiles /p %AutoPath% /s /m *.* /d -7 /c "cmd /c del /f @path">nul 2>nul
ping 127.0.0.1 -n 15 > nul

for /f "tokens=*" %%a in ('dir /b /ad /s^|sort /r') do rd "%%a" 2>nul
ping 127.0.0.1 -n 15 > nul


exit 0

  

posted on 2019-04-29 12:26  张缤分  阅读(441)  评论(0编辑  收藏  举报

导航