- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Help with Perl
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-21-2009 03:04 AM
тАО05-21-2009 03:04 AM
Some very kind forum members helped me put together this perl command below which I'm using to tell me how many files are in a directory which are 15 minutes older than the system date:
perl -MFile::Find -le '$path=shift||qq(.);find(sub{print $File::Find::name if -f $_ && -M _ >= ((15*60)/(60*60*24))},$path)' /oraother/tes/comms/outtray | wc -l
But what I need now is to modify this command to find out how many files that are not of a "0" byte size in a given directory. I don't know Perl I'm afraid so don't know where to start. Any suggestions would be very appreciated.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-21-2009 03:35 AM
тАО05-21-2009 03:35 AM
Re: Help with Perl
This is quite simple:
# perl -MFile::Find -le '$path=shift||qq(.);find(sub{print $File::Find::name if -f $_ && -s _},$path)'
...returns the non-zero size files. Change the '-s' to '-z' to return files of zero size.
For things like this, Perl is probably overkill. You could simply do:
# find . -type f ! -size 0c
...to return files with size greater than zero and:
# find . -type f -size 0c
...to return files of size zero.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-21-2009 03:49 AM
тАО05-21-2009 03:49 AM
Re: Help with Perl
To find out all zero bytes file use find command
#find /home -type f -size 0c -exec ls -l {} \;
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-21-2009 04:18 AM
тАО05-21-2009 04:18 AM
Re: Help with Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-21-2009 04:28 AM
тАО05-21-2009 04:28 AM
Solution> what I actually need to still to get a total number of files in a given directory which are not of a zero byte size and which are 15 minutes or more older than the system date.
Ah. that makes better sense:
# perl -MFile::Find -le '$path=shift||qq(.);find(sub{print $File::Find::name if -f $_ && -s _ && -M _ >= ((15*60)/(60*60*24))},$path)'
...which simply adds (ands) the test for file size that I first showed.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-21-2009 05:03 AM
тАО05-21-2009 05:03 AM