r-- 1 nginx nginx 1.3G Aug 19 23:59 visit-2018-08-19
-rw-r--r-- 1 nginx nginx 1.5G Aug 20 23:59 visit-2018-08-20
-rw-r--r-- 1 nginx nginx 1.7G Aug 21 23:59 visit-2018-08-21
-rw-r--r-- 1 nginx nginx 1.3G Aug 22 23:59 visit-2018-08-22
-rw-r--r-- 1 nginx nginx 1.5G Aug 23 23:59 visit-2018-08-23
-rw-r--r-- 1 nginx nginx 1.4G Aug 24 23:59 visit-2018-08-24
-rw-r--r-- 1 nginx nginx 1.3G Aug 25 23:59 visit-2018-08-25
-rw-r--r-- 1 nginx nginx 1.3G Aug 26 23:59 visit-2018-08-26
-rw-r--r-- 1 nginx nginx 1.7G Aug 27 23:59 visit-2018-08-27
-rw-r--r-- 1 nginx nginx 1.8G Aug 28 23:59 visit-2018-08-28
-rw-r--r-- 1 nginx nginx 1.6G Aug 29 23:59 visit-2018-08-29
-rw-r--r-- 1 nginx nginx 1.8G Aug 30 23:59 visit-2018-08-30
-rw-r--r-- 1 nginx nginx 1.4G Aug 31 23:59 visit-2018-08-31
-rw-r--r-- 1 nginx nginx 1.1G Sep 1 23:59 visit-2018-09-01
-rw-r--r-- 1 nginx nginx 1.1G Sep 2 23:59 visit-2018-09-02
-rw-r--r-- 1 nginx nginx 1.7G Sep 3 23:59 visit-2018-09-03
-rw-r--r-- 1 nginx nginx 1.7G Sep 4 23:59 visit-2018-09-04
-rw-r--r-- 1 nginx nginx 1.7G Sep 5 23:59 visit-2018-09-05
-rw-r--r-- 1 nginx nginx 1.9G Sep 6 23:59 visit-2018-09-06
-rw-r--r-- 1 nginx nginx 1.8G Sep 7 23:59 visit-2018-09-07
-rw-r--r-- 1 nginx nginx 1.8G Sep 8 23:59 visit-2018-09-08
-rw-r--r-- 1 nginx nginx 1.5G Sep 9 23:59 visit-2018-09-09
-rw-r--r-- 1 nginx nginx 1.6G Sep 10 23:59 visit-2018-09-10
-rw-r--r-- 1 nginx nginx 1.5G Sep 11 23:59 visit-2018-09-11
-rw-r--r-- 1 nginx nginx 1.5G Sep 12 23:59 visit-2018-09-12
-rw-r--r-- 1 nginx nginx 1.5G Sep 13 23:59 visit-2018-09-13
-rw-r--r-- 1 nginx nginx 1.3G Sep 14 19:31 visit-2018-09-14
-rw-r--r-- 1 nginx nginx 729M Sep 15 19:21 visit-2018-09-15
[root@test ulog]# ll -h
[root@test ulog]# rm -f `ls | grep'\-'01'\-' `;du --max-depth=1 -h /data;
-bash: grep\-01\-: command not found
641M /data/content
870G /data/elasticsearch
16K /data/lost+found
60K /data/sem
7.6G /data/vlog
250G /data/ulog
1.2T /data
[root@test ulog]# rm -f `ls | grep '\-'01'\-' `;du --max-depth=1 -h /data;
641M /data/content
870G /data/elasticsearch
16K /data/lost+found
60K /data/sem
7.6G /data/vlog
234G /data/ulog
1.1T /data
[root@test ulog]# rm -f `ls | grep '\-'01'\-' `;du --max-depth=1 -h /data;
641M /data/content
870G /data/elasticsearch
16K /data/lost+found
60K /data/sem
7.6G /data/vlog
234G /data/ulog
1.1T /data
[root@test ulog]# rm -f `ls | grep '\-'02'\-' `;du --max-depth=1 -h /data;
641M /data/content
870G /data/elasticsearch
16K /data/lost+found
60K /data/sem
7.6G /data/vlog
223G /data/ulog
1.1T /data
[root@test ulog]# rm -f `ls | grep '\-'03'\-' `;du --max-depth=1 -h /data;
641M /data/content
870G /data/elasticsearch
16K /data/lost+found
60K /data/sem
7.6G /data/vlog
202G /data/ulog
1.1T /data
[root@test ulog]# rm -f `ls | grep '\-'04'\-' `;du --max-depth=1 -h /data;
641M /data/content
870G /data/elasticsearch
16K /data/lost+found
60K /data/sem
7.6G /data/vlog
168G /data/ulog
1.1T /data
[root@test ulog]#
批量删除多个文件夹下的文件
3个文件夹中的10月份的文件
201188 -rw-r--r-- 1 root root 206012208 Dec 6 08:45 visit-2018-12-05
62548 -rw-r--r-- 1 root root 64047734 Dec 6 08:45 visit-2018-12-06
[root@d mapReduceVisitorLog]# rm -rf {a,b,c}/**-10-*
[root@d datadir]# ll -ash
total 5.3G
4.0K drwxr-xr-x 6 mysql mysql 4.0K Apr 8 11:14 .
4.0K drwxr-xr-x 4 mysql mysql 4.0K Dec 21 17:15 ..
4.0K -rw-r----- 1 mysql mysql 56 Dec 21 17:30 auto.cnf
8.0K -rw-r----- 1 mysql mysql 6.4K Dec 24 10:26 binlog.000001
4.0K -rw-r----- 1 mysql mysql 357 Dec 24 10:30 binlog.000002
4.0K -rw-r----- 1 mysql mysql 178 Dec 24 10:38 binlog.000003
4.0K -rw-r----- 1 mysql mysql 178 Dec 24 10:39 binlog.000004
4.0K -rw-r----- 1 mysql mysql 178 Dec 24 10:39 binlog.000005
4.0K -rw-r----- 1 mysql mysql 178 Dec 24 10:40 binlog.000006
4.0K -rw-r----- 1 mysql mysql 178 Dec 24 11:16 binlog.000007
4.0K -rw-r----- 1 mysql mysql 178 Dec 24 17:10 binlog.000008
4.0K -rw-r----- 1 mysql mysql 466 Dec 24 17:18 binlog.000009
4.0K -rw-r----- 1 mysql mysql 178 Dec 24 17:20 binlog.000010
4.0K -rw-r----- 1 mysql mysql 178 Dec 24 17:26 binlog.000011
4.0K -rw-r----- 1 mysql mysql 178 Dec 24 17:32 binlog.000012
96K -rw-r----- 1 mysql mysql 94K Dec 24 17:37 binlog.000013
4.0K -rw-r----- 1 mysql mysql 178 Dec 24 17:50 binlog.000014
1.1G -rw-r----- 1 mysql mysql 1.1G Dec 24 20:07 binlog.000015
1.1G -rw-r----- 1 mysql mysql 1.1G Dec 24 21:32 binlog.000016
1.1G -rw-r----- 1 mysql mysql 1.1G Dec 24 22:57 binlog.000017
976M -rw-r----- 1 mysql mysql 976M Dec 25 08:56 binlog.000018
4.0K -rw-r----- 1 mysql mysql 178 Dec 25 09:29 binlog.000019
4.0K -rw-r----- 1 mysql mysql 178 Dec 25 09:35 binlog.000020
4.0K -rw-r----- 1 mysql mysql 178 Dec 25 10:02 binlog.000021
956M -rw-r----- 1 mysql mysql 956M Dec 30 09:41 binlog.000022
4.0K -rw-r----- 1 mysql mysql 918 Jan 7 14:19 binlog.000023
4.0K -rw-r----- 1 mysql mysql 368 Dec 30 09:44 binlog.index
4.0K -rw------- 1 mysql mysql 1.7K Dec 21 17:30 ca-key.pem
4.0K -rw-r--r-- 1 mysql mysql 1.1K Dec 21 17:30 ca.pem
4.0K -rw-r--r-- 1 mysql mysql 1.1K Dec 21 17:30 client-cert.pem
4.0K -rw------- 1 mysql mysql 1.7K Dec 21 17:30 client-key.pem
4.0K -rw-r----- 1 mysql mysql 179 Dec 24 10:59 d-slow.log
20K -rw-r----- 1 mysql mysql 19K Dec 30 09:41 ib_buffer_pool
76M -rw-r----- 1 mysql mysql 76M Jan 7 14:25 ibdata1
49M -rw-r----- 1 mysql mysql 48M Jan 7 14:26 ib_logfile0
49M -rw-r----- 1 mysql mysql 48M Jan 7 14:06 ib_logfile1
12M -rw-r----- 1 mysql mysql 12M Dec 30 09:44 ibtmp1
4.0K drwxr-x--- 2 mysql mysql 4.0K Dec 30 09:44 #innodb_temp
12K drwxr-x--- 2 mysql mysql 12K Dec 24 17:59 mysql
4.0K -rw-r----- 1 mysql mysql 259 Dec 25 10:02 mysqld-auto.cnf
125M -rw-r----- 1 mysql mysql 124M Jan 7 14:19 mysql.ibd
4.0K drwxr-x--- 2 mysql mysql 4.0K Dec 21 17:30 performance_schema
4.0K -rw------- 1 mysql mysql 1.7K Dec 21 17:31 private_key.pem
4.0K -rw-r--r-- 1 mysql mysql 452 Dec 21 17:31 public_key.pem
4.0K -rw-r--r-- 1 mysql mysql 1.1K Dec 21 17:30 server-cert.pem
4.0K -rw------- 1 mysql mysql 1.7K Dec 21 17:30 server-key.pem
4.0K drwxr-x--- 2 mysql mysql 4.0K Dec 21 17:31 sys
18M -rw-r----- 1 mysql mysql 17M Jan 7 14:19 undo_001
20M -rw-r----- 1 mysql mysql 19M Jan 7 14:19 undo_002
[root@d datadir]# rm -f ` ls | grep binlog.00`
[root@d datadir]# ll -ash
total 345M
4.0K drwxr-xr-x 6 mysql mysql 4.0K Apr 8 11:16 .
4.0K drwxr-xr-x 4 mysql mysql 4.0K Dec 21 17:15 ..
4.0K -rw-r----- 1 mysql mysql 56 Dec 21 17:30 auto.cnf
4.0K -rw-r----- 1 mysql mysql 368 Dec 30 09:44 binlog.index
4.0K -rw------- 1 mysql mysql 1.7K Dec 21 17:30 ca-key.pem
4.0K -rw-r--r-- 1 mysql mysql 1.1K Dec 21 17:30 ca.pem
4.0K -rw-r--r-- 1 mysql mysql 1.1K Dec 21 17:30 client-cert.pem
4.0K -rw------- 1 mysql mysql 1.7K Dec 21 17:30 client-key.pem
4.0K -rw-r----- 1 mysql mysql 179 Dec 24 10:59 d-slow.log
20K -rw-r----- 1 mysql mysql 19K Dec 30 09:41 ib_buffer_pool
76M -rw-r----- 1 mysql mysql 76M Jan 7 14:25 ibdata1
49M -rw-r----- 1 mysql mysql 48M Jan 7 14:26 ib_logfile0
49M -rw-r----- 1 mysql mysql 48M Jan 7 14:06 ib_logfile1
12M -rw-r----- 1 mysql mysql 12M Dec 30 09:44 ibtmp1
4.0K drwxr-x--- 2 mysql mysql 4.0K Dec 30 09:44 #innodb_temp
12K drwxr-x--- 2 mysql mysql 12K Dec 24 17:59 mysql
4.0K -rw-r----- 1 mysql mysql 259 Dec 25 10:02 mysqld-auto.cnf
125M -rw-r----- 1 mysql mysql 124M Jan 7 14:19 mysql.ibd
4.0K drwxr-x--- 2 mysql mysql 4.0K Dec 21 17:30 performance_schema
4.0K -rw------- 1 mysql mysql 1.7K Dec 21 17:31 private_key.pem
4.0K -rw-r--r-- 1 mysql mysql 452 Dec 21 17:31 public_key.pem
4.0K -rw-r--r-- 1 mysql mysql 1.1K Dec 21 17:30 server-cert.pem
4.0K -rw------- 1 mysql mysql 1.7K Dec 21 17:30 server-key.pem
4.0K drwxr-x--- 2 mysql mysql 4.0K Dec 21 17:31 sys
18M -rw-r----- 1 mysql mysql 17M Jan 7 14:19 undo_001
20M -rw-r----- 1 mysql mysql 19M Jan 7 14:19 undo_002
[root@d datadir]#