Created
December 26, 2017 17:14
-
-
Save ruofeidu/0281601aa09a8c692edddb8e73587ebc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob, os | |
dir_path = os.path.dirname(os.path.realpath(__file__)) | |
print(dir_path) | |
sub_dir_list = glob.glob(dir_path + '\\test2\\*') | |
for dir_item in sub_dir_list: | |
print(dir_item) | |
sub_list = glob.glob(dir_item + '\\*') | |
for item in sub_list: | |
l = glob.glob(item + "\\*") | |
files = glob.glob(item + '\\*') | |
for f in files: | |
z1 = f.find("_log") | |
z2 = f.find("_urls") | |
if z1 > 0 or z2 > 0: | |
os.remove(f) | |
continue | |
q = f.rfind("\\") | |
p = f.rfind(".") | |
if p < 0 or q < 0: | |
continue | |
try: | |
id = int(f[q+7:p]) | |
if id <= 50: | |
os.remove(f) | |
pass | |
except Exception as e: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment