i have bunch of log files and I have to delete the files of some small sizes, which were erroneous files that got created. ( 63bytes ). I have to copy only those files which have data in it .
Shell (linux);
find . -type f -size 63c -delete
Will traverse subdirectories (unless you tell it otherwise)
Since you tagged your question with "python" here is how you could do this in that language:
target_size = 63
import os
for dirpath, dirs, files in os.walk('.'):
for file in files:
path = os.path.join(dirpath, file)
if os.stat(path).st_size == target_size:
os.remove(path)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With