top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Linux : Command to get list of files with zero bytes and remove them in one shot ?

+2 votes

I have a huge code base and it is showing files with zero bytes .
Can someone share a linux command to delete files with zero bytes in one attempt ?

posted Nov 30, 2015 by Vikram Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes

use the find command in the respective directory where the file with size 0 present with -delete option.

  find  ./location/  -size 0 -delete

this will do the trick :)

answer Dec 3, 2015 by Arshad Khan
Similar Questions
+3 votes

I would like to get the list of the database manage by on server through a single shell command, on UNIX. The objective is to be able to do a full export of all dbs for validation purposes.
Right now, I can see only two ways to do this.
- Start mongo, type show dbs, to a manual copy of the list and exit. I do not like this way as this requires several manual operations.
- Scan the files.*.0 in the db directory.
This works but is dependent on the format of the database.Is there any better way to list all the DBs managed by a server through a single command? I am using MongoDB 3.0.4 on Scientific Linux.

0 votes

Given a list of rpms on one system (rpm -qa > list.txt), is there a one-shot command that I can run on another system to remove all of the rpms not listed and add any that are on the list and not present on the second system?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.