Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-16-2007, 03:08 AM   #1
Registered: Oct 2005
Posts: 324

Rep: Reputation: 32
how to delete all files in one command for all user

Hi to all.

I setup Mailserver with spamassassin using Maildir format. I want to delete all files under .junkmail dir. The thing is all user has .junkmail dir and i manually delete all the contents per user. Is there a way where I can delete all the files in all directories of .junkmail in all user without doing it maunally?

Old 04-16-2007, 03:14 AM   #2
Registered: Sep 2006
Location: Silesia
Distribution: Debian GNU/Linux 4.0, ArchLinux, OpenBSD
Posts: 190
Blog Entries: 2

Rep: Reputation: 31
I never tried it but rm /home/*/.junkmail should work
Old 04-16-2007, 03:43 AM   #3
Registered: Oct 2005
Posts: 324

Original Poster
Rep: Reputation: 32
hahahaha why didn't I think of that. Such an idiot I am.

Old 04-16-2007, 08:32 PM   #4
Junior Hacker
Senior Member
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
If I read your post correctly, .junkmail ia a directory and you want to remove all files in that directory for all users without removing the directory itself. The command suggested above will not work. Change into the /home directory and issue this command:
[root@localhost home]# find ./*/.junkmail -type f -exec rm -fr {} \;
Always run a test of any command suggested in forums, /opt is usually empty, create temporary user folders in /opt with a couple sub folders containing files. Issue this command to remove all files in only one of the sub folders to verify it.
Old 04-16-2007, 08:56 PM   #5
Registered: Jul 2004
Location: louisiana
Distribution: fedora 4/kubuntu
Posts: 116

Rep: Reputation: 15

avallach was just missing an asterik
rm -f /home/*/.junkmail/*


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Files through Command Window ankz.upadhyay Linux - Newbie 5 03-27-2007 03:17 PM
what is the command to delete files and folders quickly. ravi Linux - General 1 03-13-2007 12:09 PM
Need to delete directories with files using command line FTP Zombie13 Linux - Software 2 03-10-2006 10:23 PM
Allow Anynomous FTP user to delete files RohanShrivastav Linux - Networking 2 10-12-2005 10:14 PM
Usedel command doesn't delete user directory? mikeshn Linux - General 2 11-22-2002 12:18 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration