-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path01_00_delete_pngfile.py
More file actions
58 lines (52 loc) · 1.72 KB
/
Copy path01_00_delete_pngfile.py
File metadata and controls
58 lines (52 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 22 01:00:19 2018
@author: user
"""
#%%
from glob import glob
from pathlib import Path, PosixPath, WindowsPath
import os
from datetime import datetime
import shutil
import _Python_utilities
import _MODIS_AOD_utilities
#%%
#######################################################
# for log file
log_dir = "logs/"
log_file = "{}{}.log".format(log_dir, os.path.basename(__file__)[:-3])
err_log_file = "{}{}_err.log".format(log_dir, os.path.basename(__file__)[:-3])
print ("log_file: {}".format(log_file))
print ("err_log_file: {}".format(err_log_file))
if not os.path.exists('{0}'.format(log_dir)):
os.makedirs('{0}'.format(log_dir))
#######################################################
#%%
#######################################################
# read all files in base directory for processing
BASEDIR = Path("/mnt/Rdata/MODIS_AOD/Aerosol/")
BASEDIR = Path("R:\MODIS_AOD/Aerosol/")
###
DOINGDIR = Path(BASEDIR/ "MOD04_3K")
DOINGDIR = Path(BASEDIR/ "MOD04_L2")
DOINGDIR = Path(BASEDIR/ "MYD04_3K")
DOINGDIR = Path(BASEDIR/ "MYD04_L2")
DOINGDIRs = sorted(_Python_utilities.getFullnameListOfsubDirs(DOINGDIR))
#print ("DOINGDIRs: ", format(DOINGDIRs))
print ("len(DOINGDIRs): ", format(len(DOINGDIRs)))
#######################################################
#%%
#DOINGDIR = DOINGDIRs[0]
for DOINGDIR in DOINGDIRs :
#DOINGDIR = Path(DOINGDIR)
print(DOINGDIR)
YDDIRs = sorted(_Python_utilities.getFullnameListOfsubDirs(DOINGDIR))
for YDDIR in YDDIRs:
YDDIR = Path(YDDIR)
print(YDDIR)
fpaths = sorted(list(YDDIR.glob('*.png')))
print(fpaths)
for fpath in fpaths:
os.remove(str(fpath))
print(f"{str(fpath.stem)} is deleted...")