当前位置:网站首页>Yyds dry inventory method of deleting expired documents in batch
Yyds dry inventory method of deleting expired documents in batch
2022-07-02 16:13:00 【liuzhen007】
Catalog
problem
There is a problem today , The details are as follows : Catalog /var/www/html/media/chunks/ There are many temporary files in , Need to delete , But if you delete it manually , It's going to be very slow , First , So let's see 3 What documents were there days ago .
The order is as follows :
find /var/www/html/media/chunks -mtime +3 -name "*.*"
The screenshot of the query result is as follows :
I made a rough calculation , About a thousand .
If you delete it manually , It is estimated to wait until the end of time .
solve
Since it is necessary to delete expired files according to time , Then we must know some concepts related to time . There are three information about the time of the file :atime、mtime、ctime, They mean, respectively : Last visit time (access time)、 Last changed (modify time) And the latest status change time (change time). Based on our demands , Obviously , I need to use mtime Time .
Let's take a look at the specific forms of these three times through an example :
Okay , Now that it is clear that you need to use mtime Time parameters , Let's see how to use this command parameter .
- Mode one
find . -mtime n
among ,n Is the number , It means in the current directory n Days ago “ In a day ” A file with changed content .
- Mode two
find . -mtime +n
among ,n Is the number , It means in the current directory n Days ago ( Not included n The day itself ) The file name of the changed content .
- Mode three
find . -mtime -n
among ,n Is the number , It means in the current directory n Within days ( contain n The day itself ) The file name of the changed content .
Last , Understand more vividly through a picture n The actual meaning of :
Okay , Now you can do it directly :
find /var/www/html/media/chunks -mtime +3 -name "*.*" -exec rm -Rf {} \;
The above command is used to delete all the files queried three days ago .
Let's execute the first query command , I found that the files have been deleted , The screenshot is as follows :
Author's brief introduction : Hello everyone , I am a Data-Mining(liuzhen007), Is a typical audio and video technology enthusiast , Before and after working in traditional radio and television giants and audio and video internet companies , Rich experience in audio and video live and on demand , Yes WebRTC、FFmpeg and Electron Have a very deep understanding of , official account : Play with audio and video . It's also CSDN Blogger 、 Huawei cloud sharing expert ( Co creation editor )、InfoQ Signed on , Welcome to follow me and share more dry goods !
边栏推荐
- Various entanglements between qvariant and Jason -- QT
- Yyds dry goods inventory hands-on teaching you to carry out the packaging and release of mofish Library (fishing Library)
- AWS云主机扩容
- How to import a billion level offline CSV into Nepal graph
- End time processing method of wechat v3native payment settings
- Set the background picture in the idea (ultra detailed)
- AWS virtual machine expansion
- Invalid bound statement (not found)解决方法总结
- 数据湖(十一):Iceberg表数据组织与查询
- 去除router-link中的下划线
猜你喜欢
手机app通达信添加自定义公式(分时T+0)为例子讲解
Write your own CPU Chapter 11 - learning notes
SSM整合-异常处理器及项目异常处理方案
The light of ideal never dies
[Yu Yue education] reference materials of sensing and intelligent control technology of Nanjing University of Technology
Idea public method extraction shortcut key
如何实现十亿级离线 CSV 导入 Nebula Graph
Idea jar package conflict troubleshooting
idea 公共方法抽取快捷键
JS learning notes - variables
随机推荐
Practice of constructing ten billion relationship knowledge map based on Nebula graph
Add user-defined formula (time sharing t+0) to mobile app access as an example
基于 Nebula Graph 构建百亿关系知识图谱实践
Analysis of the difference between array and linked list
Mobile web development learning notes - Layout
2022 the latest and most detailed will successfully set the background image in vscade and solve unsupported problems at the same time
Comment réaliser un graphique Nebula d'importation CSV hors ligne de niveau milliard
死锁的条件及解决方法
win10系统升级一段时间后,内存占用过高
注册成为harmonyos开发者并安装DevEco Studio 3.0 Beta2 for HarmonyOS
Bone conduction non ear Bluetooth headset brand, bone conduction Bluetooth headset brand recommendation
GraphX 图计算实践之模式匹配抽取特定子图
Group by的用法
Target detection - make your own deep learning target detection data set with labelimg
多数据源配置代码
理想之光不灭
Storage, reading and writing of blood relationship data of Nepal Graph & Data Warehouse
Kubernetes family container housekeeper pod online Q & A?
End time processing method of wechat v3native payment settings
Pandora IOT development board learning (RT thread) - Experiment 2 RGB LED experiment (learning notes)