These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Delete 30GB of files in a mailbox on the new forum.
Hi,
Because of this issue (http://www.virtualmin.com/node/6452) where emails are being sent to root every time a cron run, I now have over 30GB worth of emails in my inbox! I never used the email address of the root account so I didn't know until I have a space problem.
How do i delete all these files? I tried something like rm - .. find -delete .. and they dont seem to work and just stop working without any files being deleted. I couldn't even count how many files are in the with ls -1R | wc -l
I now have to use PHP to delete them but it takes over a minute to delete just 1500 files :(.
Any help would be appreciated.
Thank you.
-Neena
you can navigate into the directory holding your emails and issue something like: rm -f *
30GB will still take some time
I did through ssh and it just freezes ..
30GB of email is quite a bit :-)
After a few thousand files, globbing characters such as "*" will usually stop working (delivering "Argument list too long" errors).
For that number of files, which are all in a single dir -- it really could take several hours.
I would probably start with this command:
find /root/Maildir/new | xargs rm
If, after a few hours, you don't think it's making a change in the total number of files... you could always try using this:
rm -rf /root/Maildir/new
If that doesn't work either -- if you run the command "dmesg", do you see any errors towards the end?
-Eric
Will try that and get back to you. Thank you, Eric.
For like 8 hours of running the command, 2 GB of files were deleted with rm -rf /root/... This is going to take many days :(
I ran dmesg and i dont think there is any error messages.
webmin > servers > postfix > user mailboxes > module config:
set "Show button to delete entire mailbox?" to yes
go to user mailboxes, click root, then "delete mailbox", are you sure etc..
return to module config via user mailboxes and switch off "Show button to delete entire mailbox?"
Thanks! But I think I ended up using PHP to delete like 500 files at time or something.
I just had the same issue but the folder was 2.4GB.
Using the webmin filemanager:
I renamed /root/maildir/cur to /root/maildir/cur.old
recreated /root/maildir/cur 700
deleted /root/maildir/cur.old
Whole job took less than 3 minutes.