刪除文件及文件夾命令

方法一:

@echo off
::演示:刪除指定路徑下指定天數之前(以文件的最后修改日期為準)的文件。
::如果演示結果無誤,把del前面的echo去掉,即可實現真正刪除。
::本例需要Win2003/Vista/Win7系統自帶的forfiles命令的支持rem 指定待刪除文件的存放路徑
set SrcDir=D:\oraclebak
rem 指定天數
set DaysAgo=1
forfiles /p %SrcDir% /s /m *.* /d -%DaysAgo%  /c "cmd /c if @ISDIR==TRUE (echo rmdir /q /s @PATH) else (echo del /f @PATH)"
pause

方法二:

::刪除與批處理在同一目錄里的30天前的文件夾,日期的判斷以文件夾的創建日期為準。
::此文件要放在要刪除的文件夾目錄里
>dstdate.vbs echo LastDate=date()-30
>>dstdate.vbs echo FmtDate=right(year(LastDate),4) ^& right("0" ^& month(LastDate),2) ^& right("0" ^& day(LastDate),2)
>>dstdate.vbs echo wscript.echo FmtDate
::獲取30天前的日期
for /f %%a in ('cscript /nologo dstdate.vbs') do set "dstdate=%%a"
::格式化日期為年/月/set dstdate=%dstdate:~0,4%^/%dstdate:~4,2%^/%dstdate:~6,2%
del dstdate.vbs /f /q >nul
for /f "skip=1 tokens=1-4 delims= " %%a in ('dir /tc /ad ^| find ":"') do (
if %%a lss %dstdate% rd "%%d" /s /q
)
pause

?

轉載于:https://www.cnblogs.com/leebokeyuan/p/9204965.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/390225.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/390225.shtml
英文地址,請注明出處:http://en.pswp.cn/news/390225.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

BZOJ 3527: [ZJOI2014]力(FFT)

題意 給出\(n\)個數\(q_i\),給出\(Fj\)的定義如下&#xff1a; \[F_j\sum \limits _ {i < j} \frac{q_iq_j}{(i-j)^2}-\sum \limits _{i >j} \frac{q_iq_j}{(i-j)^2}.\] 令\(E_iF_i/q_i\)&#xff0c;求\(E_i\). 題解 一開始沒發現求\(E_i\)... 其實題目還更容易想了... …

c# 實現刷卡_如何在RecyclerView中實現“刷卡選項”

c# 實現刷卡Lets say a user of your site wants to edit a list item without opening the item and looking for editing options. If you can enable this functionality, it gives that user a good User Experience. 假設您網站的用戶想要在不打開列表項并尋找編輯選項的情…

批處理命令無法連續執行

如題&#xff0c;博主一開始的批處理命令是這樣的&#xff1a; cd node_modules cd heapdump node-gyp rebuild cd .. cd v8-profiler-node8 node-pre-gyp rebuild cd .. cd utf-8-validate node-gyp rebuild cd .. cd bufferutil node-gyp rebuild pause執行結果&#xff1…

sql語句中的in用法示例_示例中JavaScript in操作符

sql語句中的in用法示例One of the first topics you’ll come across when learning JavaScript (or any other programming language) are operators. 學習JavaScript(或任何其他編程語言)時遇到的第一個主題之一是運算符。 The most common operators are the arithmetic, l…

vue項目實戰總結

馬上過年了&#xff0c;最近工作不太忙&#xff0c;再加上本人最近比較懶&#xff0c;毫無斗志&#xff0c;不愿學習新東西&#xff0c;或許是要過年的緣故(感覺像是在找接口)。 就把前一段時間做過的vue項目&#xff0c;進行一次完整的總結。 這次算是詳細總結&#xff0c;會從…

Linux !的使用

轉自&#xff1a;https://www.linuxidc.com/Linux/2015-05/117774.htm 一、history    78 cd /mnt/ 79 ls 80 cd / 81 history 82 ls 83 ls /mnt/ !78 相當于執行cd /mnt !-6 也相當于執行cd /mnt 二、!$ cd /mnt ls !$ 相當于執行 ls /mnt轉載于:https://www.cnblogs.…

881. 救生艇

881. 救生艇 第 i 個人的體重為 people[i]&#xff0c;每艘船可以承載的最大重量為 limit。 每艘船最多可同時載兩人&#xff0c;但條件是這些人的重量之和最多為 limit。 返回載到每一個人所需的最小船數。(保證每個人都能被船載)。 示例 1&#xff1a; 輸入&#xff1a;…

使用python數據分析_如何使用Python提升您的數據分析技能

使用python數據分析If youre learning Python, youve likely heard about sci-kit-learn, NumPy and Pandas. And these are all important libraries to learn. But there is more to them than you might initially realize.如果您正在學習Python&#xff0c;則可能聽說過sci…

openresty 日志輸出的處理

最近出了個故障&#xff0c;有個接口的請求居然出現了長達幾十秒的處理時間&#xff0c;由于日志缺乏&#xff0c;網絡故障也解除了&#xff0c;就沒法再重現這個故障了。為了可以在下次出現問題的時候能追查到問題&#xff0c;所以需要添加一些追蹤日志。添加這些追蹤日志&…

誰是贏家_贏家的真正作品是股東

誰是贏家As I wrote in the article “5 Skills to Look For When Hiring Remote Talent,” remote work is a fast emerging segment of the labor market. Today roughly eight million Americans work remotely full-time. And among the most commonly held jobs include m…

博客園代碼黑色主題高亮設置

參考鏈接&#xff1a; https://segmentfault.com/a/1190000013001367 先發鏈接&#xff0c;有空實踐后會整理。我的GitHub地址&#xff1a;https://github.com/heizemingjun我的博客園地址&#xff1a;http://www.cnblogs.com/chenmingjun我的螞蟻筆記博客地址&#xff1a;http…

Matplotlib課程–學習Python數據可視化

Learn the basics of Matplotlib in this crash course tutorial. Matplotlib is an amazing data visualization library for Python. You will also learn how to apply Matplotlib to real-world problems.在此速成班教程中學習Matplotlib的基礎知識。 Matplotlib是一個很棒…

Android 開發使用 Gradle 配置構建庫模塊的工作方式

Android 開發過程中&#xff0c;我們不可避免地需要引入其他人的工作成果。減少重復“造輪子”的時間&#xff0c;投入到更有意義的核心任務當中。Android 庫模塊在結構上與 Android 應用模塊相同。提供構建應用所需的一切內容&#xff0c;包括源代碼&#xff08;src&#xff0…

vue 組件庫發布_如何創建和發布Vue組件庫

vue 組件庫發布Component libraries are all the rage these days. They make it easy to maintain a consistent look and feel across an application. 如今&#xff0c;組件庫風行一時。 它們使在整個應用程序中保持一致的外觀和感覺變得容易。 Ive used a variety of diff…

angular

<input type"file" id"one-input" accept"image/*" file-model"images" οnchange"angular.element(this).scope().img_upload(this.files)"/>轉載于:https://www.cnblogs.com/loweringye/p/8441437.html

Java網絡編程 — Netty入門

認識Netty Netty簡介 Netty is an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients. Netty is a NIO client server framework which enables quick and easy development o…

har文件分析http_如何使用HAR文件分析一段時間內的性能

har文件分析httpWhen I consider the performance of a website, several things come to mind. I think about looking at the requests of a page, understanding what resources are being loaded, and how long these resources take to be available to users.當我考慮網站…

第一階段:前端開發_Mysql——表與表之間的關系

2018-06-26 表與表之間的關系 一、一對多關系&#xff1a; 常見實例&#xff1a;分類和商品&#xff0c;部門和員工一對多建表原則&#xff1a;在從表&#xff08;多方&#xff09;創建一個字段&#xff0c;字段作為外鍵指向主表&#xff08;一方&#xff09;的一方      …

按鈕提交在url后添加字段_在輸入字段上定向單擊“清除”按鈕(X)

按鈕提交在url后添加字段jQuery makes it easy to get your project up and running. Though its fallen out of favor in recent years, its still worth learning the basics, especially if you want quick access to its powerful methods.jQuery使您可以輕松啟動和運行項目…

429. N 叉樹的層序遍歷

429. N 叉樹的層序遍歷 給定一個 N 叉樹&#xff0c;返回其節點值的層序遍歷。&#xff08;即從左到右&#xff0c;逐層遍歷&#xff09;。 樹的序列化輸入是用層序遍歷&#xff0c;每組子節點都由 null 值分隔&#xff08;參見示例&#xff09;。 - 示例 1&#xff1a;輸入…