-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile_navigation.py
More file actions
105 lines (72 loc) · 1.92 KB
/
file_navigation.py
File metadata and controls
105 lines (72 loc) · 1.92 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import os
#This is getting the current working directory
print(os.getcwd())
#This is changing the directory from above
os.chdir('/Users/johndoe/Git/LexDAO/LexDAO Membership Token')
'''
#trying to copy file and then increment the name by +1 each copy and run for a specified range
for file in os.listdir():
name, ext = os.path.splitext(file)
value = int(name)
for i in range (0, 10):
i += 1
new_name = f"{i}{ext}"
print(new_name)
'''
#Shows all the files in the Directory
'''
print(os.listdir())
'''
#helps clean the list of the files vs. above
'''
for file in os.listdir():
print(file)
'''
#This splits the text of the extension and the file name
'''
for file in os.listdir():
name, ext = os.path.splitext(file)
print(name)
print(ext)
'''
#this is to reformat the file to move the names around
'''
for file in os.listdir():
name, ext = os.path.splitext(file)
splitted = name.split("-")
splitted = [s.strip() for s in splitted]
new_name = f"{splitted[3].zfill(5)}-{splitted[1]}-{splitted[0]}-{splitted[2]}{ext}"
print(new_name)
'''
'''
#this will expand on the above code and rename the files
for file in os.listdir():
name, ext = os.path.splitext(file)
splitted = name.split("-")
splitted = [s.strip() for s in splitted]
new_name = f"{splitted[3].zfill(5)}_{splitted[2]}_{splitted[0]}_{splitted[1]}{ext}"
os.rename(file, new_name)
'''
#for value in range (10):
# print(value)
#checks if an object is iterable
'''
file_name = os.listdir()
def is_iterable(file_name):
try:
iter(file_name)
return True
except TypeError:
return False
print(is_iterable(2))
'''
'''
for file in os.listdir():
name, ext = os.path.splitext(file)
for name in os.path.splitext(file):
print(file_name)
print(name)
print(ext)
'''
#for file in os.listdir():
# name, ext = os.path.splitext(file)