-
Notifications
You must be signed in to change notification settings - Fork 1
/
FileOperations.py
49 lines (38 loc) · 929 Bytes
/
FileOperations.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os
import shutil as sh
from glob import glob
def full_path(path):
return glob(path)
def rm(path):
file_list = full_path(path)
if len(file_list)==0:
...
else:
for f in file_list:
try:
os.remove(f)
except FileNotFoundError:
print(f'--> {f} not found')
return file_list
def mv(src, dst):
file_list = full_path(src)
if len(file_list)==0:
...
else:
for f in file_list:
try:
sh.move(f, dst)
except FileNotFoundError:
print(f'--> {f} no found')
return file_list
def cp(src, dst):
file_list = full_path(src)
if len(file_list)==0:
...
else:
for f in file_list:
try:
sh.copy(f, dst)
except FileNotFoundError:
print(f'--> {f} no found')
return file_list