-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrganizeMusic.py
More file actions
40 lines (32 loc) · 1.39 KB
/
OrganizeMusic.py
File metadata and controls
40 lines (32 loc) · 1.39 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
#import(s)
import os
import shutil
#Set a directory
directory = r"C:\\this\\would\\be your working\\directory"
writingPath=r"C:\\this\\would\\be your destination\\directory"
def groupName():
i=0
for name in os.listdir(directory):
#OpenFile:
with open(os.path.join(directory, name)) as f:
fullSongName = (f'{name}')
groupName = (f'{name.split(' -')[0]}')
if not os.path.exists(writingPath+"\\"+groupName):
os.makedirs(writingPath+"\\"+groupName)
print("The full song name is: ",fullSongName)
print("The Path is : ", writingPath+"\\"+groupName)
#if (groupName == writingPath+"\\"+)
if(groupName == os.path.basename(writingPath+"\\"+groupName)):
shutil.copy(directory+"\\"+fullSongName,writingPath+"\\"+groupName)
# print("This group name is : ",groupName, i,"and will go into: ", os.path.basename(writingPath+"\\"+groupName))
i = i +1
#print("This is the recently wrote path",os.path.basename(writingPath+"\\"+groupName))
#print(type(groupName), i)
groupName()
# def loopingSongs():
# i = 0
# l = 100
# while i < 100:
# print("This is Your Value :" , i)
# i = i + 1
# loopingSongs()