Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old May 9th, 2008, 03:22 AM
Weekend Coder Weekend Coder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 77 Weekend Coder User rank is Sergeant Major (2000 - 5000 Reputation Level)Weekend Coder User rank is Sergeant Major (2000 - 5000 Reputation Level)Weekend Coder User rank is Sergeant Major (2000 - 5000 Reputation Level)Weekend Coder User rank is Sergeant Major (2000 - 5000 Reputation Level)Weekend Coder User rank is Sergeant Major (2000 - 5000 Reputation Level)Weekend Coder User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 19 h 39 m 33 sec
Reputation Power: 21
Shell Script Problem

When I run this:
Code:
find /var/spool/qmailscan/quarantine/new/* -name '*' | xargs rm -rf 2> /dev/null
I get this error
Quote:
/usr/bin/find: Argument list too long
Any ideas why?

The object of this is remove all quarantine messages from the /var/spool/qmailscan/quarantine/new directory.

Last edited by Weekend Coder : May 9th, 2008 at 03:29 AM.

Reply With Quote
  #2  
Old May 9th, 2008, 05:39 AM
L7Sqr L7Sqr is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: Constant Limbo
Posts: 548 L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level)L7Sqr User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 20 h 21 m 37 sec
Reputation Power: 42
Send a message via AIM to L7Sqr
Shell expansion.
When you pass
Code:
/var/spool/qmailscan/quarantine/new/*
to find the '*' portion of that get expanded into everything below the .../quaratine/new/ directory. So if there are 200 files below there you have, in effect, passed 200 files to find. find takes a starting point and recursively searches from there. You can limit the recursion with the -prune flag (IIRC, man find to be sure).
Also, if you are looking for everything, you dont need to pass '*' to -name, you can just let find output everything it finds. The -name flag is generally used to limit output.

Just out of curiosity, is ther any reason you are not just doing something like
Code:
 rm -rf /var/spool/qmailscan/quarantine/new
Since it seems like you are not limiting the search to any subset of what is in there...
Comments on this post
SimonJM agrees: Very valid point - simple is good!
__________________
-- I'll provide you with reference points; if they dont work, refer to something else.

While I've regularly been provided 'working' software that fails to build or work as advertised I've yet to face a Copyright/Warranty/License that isnt exact to the finest detail. Priorities, my friend. Priorities.

Reply With Quote
  #3  
Old May 9th, 2008, 12:29 PM
Weekend Coder Weekend Coder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 77 Weekend Coder User rank is Sergeant Major (2000 - 5000 Reputation Level)Weekend Coder User rank is Sergeant Major (2000 - 5000 Reputation Level)Weekend Coder User rank is Sergeant Major (2000 - 5000 Reputation Level)Weekend Coder User rank is Sergeant Major (2000 - 5000 Reputation Level)Weekend Coder User rank is Sergeant Major (2000 - 5000 Reputation Level)Weekend Coder User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 19 h 39 m 33 sec
Reputation Power: 21
Quote:
Originally Posted by L7Sqr
Just out of curiosity, is ther any reason you are not just doing something like
Code:
 rm -rf /var/spool/qmailscan/quarantine/new
None, though I don't want to get rid of the new dir, just what's in it. so I would add a /* after new. I could do something like that and make a cron job, sure.

But also, how about this: if I want to delete all the files in new daily, could I just treat that dir as a tmp dir and put a line in /etc/cron.daily/tmpwatch? Something like this...
Code:
# Delete quarantined viruses after 25 hrs...
/usr/sbin/tmpwatch -c 24 /var/spool/qmailscan/quarantine/new


Maybe that would be better than a cron job? No different? Oranges and oranges?

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Shell Script Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway