# Some help with script

**URL:** <https://www.ruby-forum.com/t/some-help-with-script/82238>\
**Category:** Ruby\
**Created:** [January 18, 2007, 1:26pm UTC](https://www.ruby-forum.com/t/some-help-with-script/82238 "2007-01-18T13:26:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![R.Smits](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@R.Smits](https://www.ruby-forum.com/u/R.Smits)\
**Post date:** [January 18, 2007, 1:26pm UTC](https://www.ruby-forum.com/t/some-help-with-script/82238/1 "2007-01-18T13:26:50Z")

</div>

Hello,

I am not good with ruby , but I must change something in a script. Can  
someone help me in the right direction ?

* * *

## def initialize # This is the directory where amavisd-new stores the quarantined emails. @directory = “/home/amavis/quarantine” @dateline = (Date.today - 1).strftime("%Y%m%d") @report\_date = (Date.today - 1).strftime("%d/%m/%y") # This is the file pattern used to match the quarantined spam # emails in the quarantined email directory. This is used so that # only spam (and not virii etc.) from the report day are matched. @file\_patt = “spam-_-#{@dateline}-_.gz” @spams = Array.new

The directory with the spamfiles I need is in  
/home/amavis/quarantaine/2007-01-17-spam

But this should always be yesterday !

Files in this directory are like : spam-prAizOahLojn.gz  
(Anything with spam-\*)

I should change something like : Date.today - 1  
But what date syntax ?

I would really appreciate your help !

Greetings… Richard Smits

---

<div class="post-metadata">

**Author:** ![R.Smits](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@R.Smits](https://www.ruby-forum.com/u/R.Smits)\
**Post date:** [January 18, 2007, 2:11pm UTC](https://www.ruby-forum.com/t/some-help-with-script/82238/2 "2007-01-18T14:11:17Z")

</div>

On 18.01.2007 13:22, R.Smits wrote:

> ```
> @dateline = (Date.today - 1).strftime("%Y%m%d")
> 
> ```
> 
> But this should always be yesterday !
> 
> Files in this directory are like : spam-prAizOahLojn.gz  
> (Anything with spam-\*)
> 
> I should change something like : Date.today - 1  
> But what date syntax ?

I don’t understand: the script reads already “Date.today - 1”. So what  
is your problem?

Regards

robert

---

<div class="post-metadata">

**Author:** ![R.Smits](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@R.Smits](https://www.ruby-forum.com/u/R.Smits)\
**Post date:** [January 18, 2007, 2:37pm UTC](https://www.ruby-forum.com/t/some-help-with-script/82238/3 "2007-01-18T14:37:32Z")

</div>

Robert K. wrote:

> > ```
> > @directory = "/home/amavis/quarantine"
> > 
> > ```
> 
> Regards
> 
> ```
> robert
> 
> ```

I got it,

I needed :

```
 @dateline = (Date.today - 1).strftime("%Y-%m-%d")
 @directory = "/home/amavis/quarantine/#{@dateline}-spam"
 @file_patt = "spam-*.gz"

```

But now I get a :  
./sa-daily-report.rb:101: warning: attempt to close unfinished zstream;  
reset forced.

There are A LOT of files in that directory, so my guess is that it takes  
to long.

Greetings… Richard

---

<div class="post-metadata">

**Author:** ![R.Smits](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@R.Smits](https://www.ruby-forum.com/u/R.Smits)\
**Post date:** [January 18, 2007, 2:58pm UTC](https://www.ruby-forum.com/t/some-help-with-script/82238/4 "2007-01-18T14:58:37Z")

</div>

On 2007/01/18, at 13:35, R.Smits wrote:

> But now I get a :  
> ./sa-daily-report.rb:101: warning: attempt to close unfinished  
> zstream; reset forced.

Ahem… What’s on that line?

Paulo Jorge Duarte  
Köremoved\_email\_address@domain.invalid
