Home » Infrastructure » Unix » Listing 0 Byte Files
Listing 0 Byte Files [message #190997] Mon, 04 September 2006 01:12 Go to next message
Brayan
Messages: 315
Registered: June 2002
Senior Member
Dear All,

Can anybody help me in the following.

1. List all the files(preferable using ls -l) except 0 byte files. i.e. I want to list all the files whose size is more than 0 Byte.

2. Total Number of zero byte files.

Thanking you in advance,
Ronald.
Re: Listing 0 Byte Files [message #191043 is a reply to message #190997] Mon, 04 September 2006 04:45 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
 oracle@mutation#ls -lrt
total 6
-rw-r--r--   1 oracle   dba            0 Sep  4 05:34 a
-rwxr-xr-x   1 oracle   dba            8 Sep  4 05:34 aa.sql
-rwxr-xr-x   1 oracle   dba            0 Sep  4 05:34 a.sql
-rw-r--r--   1 oracle   dba            3 Sep  4 05:52 b
-rwxr-xr-x   1 oracle   dba           70 Sep  4 05:53 somescript
oracle@mutation#find . -type f -size +0 -print
./aa.sql
./b
./somescript
oracle@mutation#find . -type f -size +0 -print | wc -l
       3


oracle@mutation#ls -lrt | awk '$5!=0' | grep -v total
-rwxr-xr-x   1 oracle   dba            8 Sep  4 05:34 aa.sql
-rw-r--r--   1 oracle   dba            3 Sep  4 05:52 b
-rwxr-xr-x   1 oracle   dba           70 Sep  4 05:53 somescript
oracle@mutation#ls -lrt | awk '$5!=0' | grep -v total | wc -l
       3
oracle@mutation#

[Updated on: Mon, 04 September 2006 15:14]

Report message to a moderator

Re: Listing 0 Byte Files [message #191140 is a reply to message #191043] Tue, 05 September 2006 00:30 Go to previous message
Brayan
Messages: 315
Registered: June 2002
Senior Member
Hi,

Thanks a lot.

Brayan.
Previous Topic: UNIX Shell scripting
Next Topic: Oracle 8i and Solaris 10
Goto Forum:
  


Current Time: Thu Mar 28 04:01:15 CDT 2024