[HPADM] Re: SUMMARY: directory search script needed ... : UNCLASS
From: MuthuKumar (kmuthukumar_at_lycos.co.uk)
Date: 10/06/04
- Previous message: Goncheroski, Joseph J., OIG DoD: "[HPADM] SUMMARY: directory search script needed ... : UNCLASS"
- In reply to: Goncheroski, Joseph J., OIG DoD: "[HPADM] SUMMARY: directory search script needed ... : UNCLASS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: "Goncheroski, Joseph J., OIG DoD" <jgonch@dodig.osd.mil>, <hpux-admin@dutchworks.nl> Date: Wed, 6 Oct 2004 18:36:56 +0530
>
> not much on scripting and in need of a script to search directory "/abc/xyz"
> for filename "joesfile" and if it is found, store it's file size in a
> variable "filesize".
>
> after struggling with punctuation, i used the following to take care of my
> search need, where joesfile is always in directory /abc/xyz:
>
> filesize=$(ll /abc/xyz/joesfile | awk `{print $5}`)
If a file named /abc/xyz/joesfile there only your file size will be there. Else it is none there.
To make more efficient then,
[[ -f /abc/xyz/joesfile ]] && filesize=$(ls -s /abc/xyz/joesfile | awk `{print $1}`)
It will give the size when the file /abc/xyz/joesfile must be there. Else it will not assign file size there.
Regards
-Muthukumar
--- =============== It is a "Virus Free Mail" =============== Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.772 / Virus Database: 519 - Release Date: 10/1/2004 -- ---> Please post QUESTIONS and SUMMARIES only!! <--- To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl Name: hpux-admin@dutchworks.nl Owner: owner-hpux-admin@dutchworks.nl Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse only) http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse & search)
- Previous message: Goncheroski, Joseph J., OIG DoD: "[HPADM] SUMMARY: directory search script needed ... : UNCLASS"
- In reply to: Goncheroski, Joseph J., OIG DoD: "[HPADM] SUMMARY: directory search script needed ... : UNCLASS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|