LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-16-2007, 04:08 AM   #1
packets
Member
 
Registered: Oct 2005
Posts: 310

Rep: Reputation: 30
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?


TIA
 
Old 04-16-2007, 04:14 AM   #2
avallach
Member
 
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, 04:43 AM   #3
packets
Member
 
Registered: Oct 2005
Posts: 310

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

Thx!!!!
 
Old 04-16-2007, 09: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:
Code:
[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, 09:56 PM   #5
dugas
Member
 
Registered: Jul 2004
Location: louisiana
Distribution: fedora 4/kubuntu
Posts: 116

Rep: Reputation: 15
almost

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


Reply


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 04:17 PM
what is the command to delete files and folders quickly. ravi Linux - General 1 03-13-2007 01:09 PM
Need to delete directories with files using command line FTP Zombie13 Linux - Software 2 03-10-2006 11:23 PM
Allow Anynomous FTP user to delete files RohanShrivastav Linux - Networking 2 10-12-2005 11:14 PM
Usedel command doesn't delete user directory? mikeshn Linux - General 2 11-22-2002 01:18 AM


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

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