I have the following script:
import os
import stat
curDir = os.getcwd()+'/test'
for (paths, dirs, files) in os.walk(curDir):
for f in files:
if os.stat(f)[stat.ST_SIZE]>0:
print f
and the folder test/:
test_folder:
--test.wav
a.exe
t1
t2
rain.wav
when i run this script with geany it gives the following error:
Traceback (most recent call last): File "new_folder_deleter.py", line 8, in <module> if os.stat(f)[stat.ST_SIZE]>0: OSError: [Errno2] No such file or directory: 'a.exe'
but when I run it with IDLE: it just prints test.wav in subfolder test_folder
Can anyone explain why it is so and how I can fix it? P.S: My aim is to browse all files and delete files with specified sizes.