簡體   English   中英

從共享文件夾Windows批處理中刪除X個較早的文件

[英]Delete X olderdays Files from Shared Folder windows batch

我想使用Windows命令行從共享文件夾中刪除15天的舊文件,

范例::

Set Shared_root=\\server\folder /* Does not work for this input , how can i make this work ?*/

Set shared_root=c:\folder     /*Works for this input */

FORFILES /p %shared_root% /d -15 /c "cmd /c ECHO /S /Q @path" >NUL 2>&1  

您可以這樣使用robocopy

(您可以使用/l開關先使用robocopy列出文件,以免發生意外)

C:\> set _robodel=%TEMP%\~robodel
C:\> MD %_robodel%
C:\> ROBOCOPY "C:\source_folder" %_robodel% /move /minage:15
C:\> del %_robodel% /q

來源

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM