ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> spamassassin-users
spamassassin-users
Re: Dumb script question
by Rick Macdougall other posts by this author
Jun 14 2005 3:52PM messages near this date
Dumb script question | Re: Dumb script question
Jonathan Nichols wrote:

>  I have POP/IMAP/SMTP on a seperate box from the spamassassin/amavis 
>  box, and I'm trying to come up with a script to take stuff out of the 
>  shared-maildir where users deposit spam that slipped through, tar it 
>  up, and move it to the other box, where yet another script will feed 
>  it to bayes.
> 
>  Most everything works, except for the cleanup! For the life of me, I 
>  can't manage to not screw this step up. heh.
> 
>  jnichols@mail bin $ cat clear_up_spam.sh
>  #!/bin/sh
>  for i in `ls /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur`; do 
>  sudo rm $i; done
>  jnichols@mail bin $
> 
>  Ok, so if I do a ls /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur 
>  then I see all the files in the directory.
> 
>  If I run this script as it is, i get stuff like this:
> 
>  rm: cannot remove 
>  `1118786978.M908087P32756V0000000000000303I0010F8DD_119.mail,S=2390:2,S': 
>  No such file or directory
>  rm: cannot remove 
>  `1118786978.M908337P32756V0000000000000303I0010F8DE_120.mail,S=2381:2,S': 
>  No such file or directory
>  rm: cannot remove 
>  `1118786978.M908585P32756V0000000000000303I0010F8DF_121.mail,S=2381:2,S': 
>  No such file or directory
>  rm: cannot remove 
>  `1118786978.M908831P32756V0000000000000303I0010F8E0_122.mail,S=1910:2,S': 
>  No such file or directory
>  rm: cannot remove 
>  `1118786978.M909071P32756V0000000000000303I0010F8E1_123.mail,S=2456:2,S': 
>  No such file or directory
>  rm: cannot remove 
>  `1118786978.M909318P32756V0000000000000303I0010F8E2_124.mail,S=3858:2,S': 
>  No such file or directory
>  rm: cannot remove 
>  `1118787339.M455809P32750V0000000000000303I0010F695_10.mail,S=2855:2,S': 
>  No such file or directory
> 
>  if I do "cd /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur" and 
>  then "for i in `ls`; do sudo rm $i; done it works just fine. I just 
>  can't manage to delete the files *without* actually sitting there and 
>  manually going into the directory and deleting them. (I know the "for, 
>  do" loop is probably slow but I also screw up xargs every time I try 
>  to use it.)
> 
>  Most everyone on here could probably beat me at shell scripting and 
>  Perl, and this is totally spamassassin stuff related, so I'm asking.. 
>  help me! :)
> 
>  -Jonathan
>  Scripting idiot

Hi,

for i in `ls /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur`; do 
sudo rm /home/vmail/shared-maildirs/Spamdrop/.Incoming/cur/$i; done

Although imapsalearn is easier.

Regards,

Rick
Thread:
Jonathan Nichols
Rick Macdougall
Jonathan Nichols
Matt Kettler
Rick Macdougall
Rick Macdougall

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved