我的 CentOS 系统用于 PHPList,它会将收到的邮件累积在此路径中:/var/qmail/mailnames/example.com/noreply/Maildir/cur
这个邮箱里曾经有几十万封邮件,都是退回的邮件,本来是要 PHPList 处理退回的,但是 PHPList 处理不完,所以我用 cleanup-maildir 脚本批量删除邮件。现在我看到 cur 目录是空的,(ls -l 奇怪地花了 10 秒才返回“total 0”),但它显示的大小很大。我的 Plesk 面板也显示邮件帐户仍然占用了很多 GB。我需要做什么?
[root@server-1012263-1 cur]# pwd
/var/qmail/mailnames/example.com/noreply/Maildir/cur
[root@server-1012263-1 cur]# ls -al
total 72520
drwx------ 2 popuser popuser 74199040 Jan 8 18:10 .
drwx------ 10 popuser popuser 4096 Jan 8 18:15 ..
[root@server-1012263-1 cur]# cd ..
[root@server-1012263-1 Maildir]# pwd
/var/qmail/mailnames/example.com/noreply/Maildir
[root@server-1012263-1 Maildir]# ls -al
total 81432
drwx------ 10 popuser popuser 4096 Jan 8 18:20 .
drwx------ 6 popuser popuser 4096 Feb 9 2017 ..
drwx------ 6 popuser popuser 4096 Apr 23 2018 .auto replies
-rwxr-xr-x 1 popuser popuser 18968 Jun 3 2016 cleanup-maildir
drwx------ 2 popuser popuser 4096 Jul 18 2017 courierimapkeywords
-rw-r--r-- 1 popuser popuser 30 Jul 14 2015 courierimapsubscribed
-rw-r--r-- 1 popuser popuser 2216005 Mar 9 2016 courierimapuiddb
-rw-r--r-- 1 popuser popuser 666592 Jun 5 2016 courierpop3dsizelist
drwx------ 2 popuser popuser 74199040 Jan 8 18:10 cur
-rw------- 1 popuser popuser 432 Jan 8 18:10 dovecot.index
-rw------- 1 popuser popuser 5250820 Jan 8 18:20 dovecot.index.cache
-rw------- 1 popuser popuser 6196 Jan 8 18:20 dovecot.index.log
-rw------- 1 popuser popuser 33028 Jan 8 18:10 dovecot.index.log.2
-rw------- 1 popuser popuser 720 Apr 23 2018 dovecot.list.index.log
-rw------- 1 popuser popuser 12632 Jan 8 18:20 dovecot-uidlist
-rw------- 1 popuser popuser 8 Apr 23 2018 dovecot-uidvalidity
-r--r--r-- 1 popuser popuser 0 Jun 6 2016 dovecot-uidvalidity.57547a5e
drwx------ 5 popuser popuser 4096 Aug 11 2017 .Drafts
-rw------- 1 popuser popuser 1910 Jan 8 18:20 maildirsize
drwx------ 2 popuser popuser 839680 Jan 8 18:20 new
drwx------ 6 popuser popuser 4096 Aug 18 2017 .Sent
drwx------ 6 popuser popuser 4096 Apr 23 2018 .Spam
-rw-r--r-- 1 popuser popuser 18 Jun 5 2016 subscriptions
drwx------ 2 popuser popuser 4096 Jan 8 18:20 tmp
[root@server-1012263-1 Maildir]# cd cur
[root@server-1012263-1 cur]# pwd
/var/qmail/mailnames/example.com/noreply/Maildir/cur
[root@server-1012263-1 cur]# find -type f -exec rm -f {} \;
[root@server-1012263-1 cur]# ls -al
total 72520
drwx------ 2 popuser popuser 74199040 Jan 8 18:25 .
drwx------ 10 popuser popuser 4096 Jan 8 18:25 ..
我的 Plesk 面板的屏幕截图显示 15GB:https://i.stack.imgur.com/3JshH.png
答案1
不ls -l
显示隐藏文件,即文件名以点开头的文件。该命令花费的时间较长,说明目录中有大量隐藏文件。请使用ls -al
, 代替。
-a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and ..
如果你绝对确定没有任何重要的东西,你可以用以下方法清空目录
cd /var/qmail/mailnames/example.com/noreply/Maildir/cur
find -type f -exec rm -f {} \;