kangpaidjo

Linux delete file with size 0 [duplicate]

Jan 17th, 2020
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.11 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. find /tmp -size  0 -print0 |xargs -0 rm --
  4.  
  5. #or
  6.  
  7. if [ ! -s /tmp/foo ] ; then
  8.   rm /tmp/foo
  9. fi
Advertisement
Add Comment
Please, Sign In to add comment