Hi.
I have some LAS files that contain nothing, but my sub program dosent like empty files, so I'm trying to write an script that removes all files smaller that ex. 10kb.
But I cant get it to work, and I'm not good at python or any type of programming...
This is the code I have been trying to get to work:
import os, os.path
for root, _, files in os.walk("C:/some/dir"):
for f in files:
fullpath = os.path.join(root, f)
try:
if os.path.getsize(fullpath) < 10 * 1024: #set file size in kb
print fullpath
os.remove(fullpath)
except WindowsError:
print "Error" + fullpath