Exforsys
+ Reply to Thread
Results 1 to 2 of 2

List of Files

This is a discussion on List of Files within the Linux forums, part of the Operating Systems category; I am working with UNIX operating system and right now I am in the process of removing all unwanted files. ...

  1. #1
    Rahulbatra is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    124

    List of Files

    I am working with UNIX operating system and right now I am in the process of removing all unwanted files. I want to get all zero bytes files stored in all directories listed so that I can delete all these at a shot. How can I get the list of all zero bytes files stored in all directories?


  2. #2
    caradoc is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    122
    For this you must write a shell script. In that first you must get the list of directories using ls command and pipe the output to find command given below as:
    find /path/to/directory -size 0 -type f -exec rm -f {} \;

    Use the above in a loop until all directories are executed with the above command. This will remove all your zero bytes files stored in all directories in your UNIX operating system.


Latest Article

Network Security Risk Assessment and Measurement

Read More...