-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtool.py
62 lines (36 loc) · 1.04 KB
/
tool.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import os
import time
import shutil
path = ""
def path_check():
if(os.getcwd() == "C:\\Users\\pro\\Desktop"):
return os.getcwd()
else:
return False
def confirm_path(path):
print path+"\\desktop_files\\"
return os.path.exists(path+"\\desktop_files\\")
def check_create_dir(path):
if path and not confirm_path(path):
os.mkdir("desktop_files")
def move_files(path):
for fil in os.listdir(path):
src = os.path.join(path,fil)
dest = os.path.join(path,"desktop_files")
if fil == "tool.py":
continue
if(os.path.isfile(fil)):
shutil.copy(src,dest)
os.remove(fil)
if __name__ == "__main__":
path = path_check()
check_create_dir(path)
move_files(path)
files_on_desktop = os.listdir(path)
for file in files_on_desktop:
print file
#def pro(ra,dirs,files):
#global all_files
#all_files.append(files)
#os.path.walk(path,pro,"er")
#print all_files