RE: unix question
- From: "Lafond, Eileen" <Eileen.Lafond@xxxxxxxxxxx>
- To: "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
- Date: Thu, 7 Oct 2010 14:32:09 -0700
Thanks, but the wc command brings up an error message of illegal action.
Eileen
-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of QuentinC
Sent: Thursday, October 07, 2010 10:39 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: unix question
> My question now is is there a way to incoorporate in this code a way to
> count the number of the output files when I do the find ls command? I
> have found several commands but they appear to be only for counting the
> files in a directory.
You may use wc -l tou count the number of lines.
Something like that :
find '/home/faserv/hrprod/cron/logs' -name '*.log' -type f -mtime +30 -print
| wc -l
It will count the number of lines sent by the find command, which is equals
to the number of files. Problem: you wont no more see the list itself. In
this case you could use a temporary file. I'm not sure if it is possible to
store the whole list (which contains a couple of lines) into a $ variable
and proceed without any temporary file.
find '/home/faserv/hrprod/cron/logs' -name '*.log' -type f -mtime +30 -print
>temp.tmp
cat temp.tmp | wc -l
In fact, I think you can simplifiy your actual delete command :
find '/home/faserv/hrprod/cron/logs' -name '*.log' -type f -mtime
+30 -delete
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
Other related posts:
- » unix question - Lafond, Eileen
- » Re: unix question - Dorene Cornwell
- » Re: unix question - Jim Bauer
- » Re: unix question - Kerneels Roos
- » RE: unix question - DaShiell, Jude T. CIV NAVAIR 1490, 1, 26
- » Re: unix question - Alex Midence
- » RE: unix question - Lafond, Eileen
- » RE: unix question - DaShiell, Jude T. CIV NAVAIR 1490, 1, 26
- » Re: unix question - Øyvind Lode
- » RE: unix question - Lafond, Eileen
- » RE: unix question - DaShiell, Jude T. CIV NAVAIR 1490, 1, 26
- » RE: unix question - Lafond, Eileen
- » Re: unix question - QuentinC
- » Re: unix question - Bill Gallik
- » RE: unix question - Lafond, Eileen
- » RE: unix question - Lafond, Eileen
- » Re: unix question - Bill Gallik