当前位置:网站首页>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 !
边栏推荐
- Tree binary search tree
- 2020.4.12 byte written test questions B DP D monotone stack
- mysql min() 求某条件下最小的值出现多个结果
- 处理gzip: stdin: not in gzip formattar: Child returned status 1tar: Error is not recoverable: exitin
- 数据库系统概论第一章简答题-期末考得怎么样?
- Original God 2.6 server download and installation tutorial
- Fiddler realizes mobile packet capturing - getting started
- 仙人掌之歌——投石问路(3)
- PyC file decompile
- 去除router-link中的下划线
猜你喜欢

数仓中的维度表与事实表

如何实现十亿级离线 CSV 导入 Nebula Graph

Xpt2046 four wire resistive touch screen

Practice of constructing ten billion relationship knowledge map based on Nebula graph

华为云服务器安装mysqlb for mysqld.service failed because the control process exited with error code.See “sys

Maui learning road (III) -- in depth discussion of winui3

OSPF - detailed explanation of NSSA area and full NSSA area (including configuration command), LSA type 7 lsa-7

Storage, reading and writing of blood relationship data of Nepal Graph & Data Warehouse

关于mysql安装的一些问题

智联招聘的基于 Nebula Graph 的推荐实践分享
随机推荐
Storage, reading and writing of blood relationship data of Nepal Graph & Data Warehouse
Invalid bound statement (not found) solution summary
Data Lake (11): Iceberg table data organization and query
Bone conduction non ear Bluetooth headset brand, bone conduction Bluetooth headset brand recommendation
处理gzip: stdin: not in gzip formattar: Child returned status 1tar: Error is not recoverable: exitin
/Bin/ld: cannot find -llz4
idea 公共方法抽取快捷键
[fluent] dart data type string type (string definition | string splicing | string API call)
/Bin/ld: cannot find -lcrypto
JS learning notes - first acquaintance
请问怎么在oracle视图中使用stustr函数
Practice of traffic recording and playback in vivo
/Bin/ld: cannot find -lpam
纪念成为首个 DAYU200 三方 demo 贡献者
Leetcode --- longest public prefix
【5G NR】RRC连接释放
/Bin/ld: cannot find -lgssapi_ krb5
Flink real-time data warehouse (7): Flink realizes the full pull module to extract data in MySQL
Kubernetes family container housekeeper pod online Q & A?
What are the necessary functions of short video app development?