Welcome to iraf.net Tuesday, May 21 2024 @ 01:31 PM GMT
Chuck Horst |
01/05/2012 08:37AM (Read 1001 times)
|
|
|
Status: offline
Registered: 04/17/2010
Posts: 4
|
I am looking for a way to test if a file is empty or not in a script. I see access to see if a file exists. What would be a good way to tell if it is empty. The returned value would be used to test.Thanks...chuck
|
|
|
|
fitz |
01/05/2012 08:37AM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
See the COUNT task (similar to unix 'wc'), e.g.[code:1:ed61d16881]count ("/dev/null") | scan (nlines, nwords, nchars, fname)
if (nchars == 0) {
# file is empty ....
}[/code:1:ed61d16881]
|
|
|
|
| |
|
Content generated in: 0.08 seconds |
|