-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.py
31 lines (23 loc) · 853 Bytes
/
delete.py
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
import os
def deleteChildTs(folderPath):
files = os.listdir(folderPath)
originFile = folderPath.split(os.path.sep)[-1] + ".ts"
for file in files:
if file == originFile:
continue
if file.endswith(".ts"):
os.remove(os.path.join(folderPath, file))
def deleteParentTs(folderPath):
originFile = folderPath.split(os.path.sep)[-1] + ".ts"
os.remove(os.path.join(folderPath, originFile))
def deleteMp4(folderPath):
files = os.listdir(folderPath)
originFile = folderPath.split(os.path.sep)[-1] + ".mp4"
for file in files:
if file != originFile:
os.remove(os.path.join(folderPath, file))
def deleteM3u8(folderPath):
files = os.listdir(folderPath)
for file in files:
if file.endswith(".m3u8"):
os.remove(os.path.join(folderPath, file))