Hi Karl,

We ran into this too, and the Unix "xargs" command took care of it
nicely.

Example:
The following purge will delete the files for a single month (assuming
you don't keep more than a year's worth, in which case you'll need to
check the year, too).

This string will prompt before purging each file:
ls -ltr|grep " Mar "|cut -c 55-99|grep -v "Mar"|xargs -p -i rm {}

Removing the "-p" purges everything that matches without prompting
first:
ls -ltr|grep " Mar "|cut -c 55-99|grep -v "Mar"|xargs -i rm {}

Our "ls -ltr" output looks like this:
-rw-rw-rw-   1 phantom  users      654558 Mar  1 02:05 FILE1.DAT
-rw-rw-rw-   1 phantom  users      638108 Mar  1 02:05 FILE2.DAT
-rw-rw-rw-   1 phantom  users     7867810 Mar  1 02:14 FILE3.DAT
-rw-rw-rw-   1 phantom  users      593882 Apr  1 02:04 FILE4.DAT
-rw-rw-rw-   1 phantom  users      569765 Apr  1 02:04 FILE5.DAT
-rw-rw-rw-   1 phantom  users     7814653 Apr  1 02:15 FILE6.DAT

The "grep -v" test makes sure that I don't purge a file name that
contains the 3-character month.

Hope this helps,
Tom Derwin

>>> [EMAIL PROTECTED] 08/21/07 9:54 AM >>>

I have routines that parse through Unix files in a directory and remove
them based on age. If the number of files exceeds some limit I've not
been
able to narrow down, I get a response from the scripts that it can't do
the job because there's too many files in the directory.
<snip>
----------------------------------------- This e-mail and any attachments may 
contain CONFIDENTIAL information, including PROTECTED HEALTH INFORMATION. If 
you are not the intended recipient, any use or disclosure of this information 
is STRICTLY PROHIBITED; you are requested to delete this e-mail and any 
attachments, notify the sender immediately, and notify the LabCorp Privacy 
Officer at [EMAIL PROTECTED] or call (877) 23-HIPAA / (877) 234-4722. 
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to