Linux command to delete empty fastq.gz files
Hi all,
I am wondering how to use Linux command to remove all the fastq.gz files within a folder.
As the compressed fastq.gz has a size of 20 bytes even if it's empty after decompressing, I am not sure how to delete (and list) them.
I tried to list them when I was in the folder - but somehow find . -size 20 returned nothing. However, ls -l did tell me there were a bunch of size 20 fastq.gz files.
Here is an example of a set of "empty" fastq.gz files:
gzip --list xxxxxxx.gz
compressed uncompressed ratio uncompressed_name
20 0 0.0% xxxxxxx.fastq
Thank you so much!
• 3,142 views
•
link
1 answer
You could use the - flag to get files smaller than a small size, for example for 20 bytes:
find . -size -20c
will give you all files smaller (-) than 20 bytes (c).
• 0 views
•
link
Log in to answer this question.
I think you are missing
coption for bytes.If you want to remove any file of size 20 bytes and under try:
To be safe, please filter by file extension and use
-iafterrm.