Re: change to a shell to Perl



Herbert wrote:
> find ${i} -mtime +30 -type f -print0 | xargs -0 compress -vf
> find ${i} -mtime +180 -type f -print0 | xargs -0 rm -vf
>
> Is ther any way to make two find command lines one using perl?

Yes, but I'm not sure you really gain anything by doing so. "find"
operations in Perl are the same as in bash - a single command (with
whatever parameters) returns a single list of files. Combining the
finds will return a list comprised of files meeting two different sets
of criteria, so you would need to sub-process this list to tell which
files are compressed and which are deleted.

For example, you could do a single "find" for all files older than 30
days and then do a conditional (if) to re-check the timestamp and
process it according to your criteria (delete if older than 180 days,
else compress it), but I would personally prefer two find operations.

.