How to move files to different folders

Hello everyone, I am trying move files based upon a the names in the spreadsheet. The files in the folder also has the same name. What I want to do is to move the files to specific folders for example:

Column N1:Filename, N2:Outro.mp3, N3:Intro.mp3, N4:piano.mp3, etc
The folder where the Files are have the same names: Outro.mp3, N3:Intro.mp3, N4:piano.mp3, etc

In Column A in the same spreadsheet they are two albums Instrumental and Vocals.

Lastly in the root folders of Instrumental and Vocals are folders of combined values of 3 columns for example 1 - HGH - Tonic(Script), 2 - LOW - Legat(Pause), etc. How can the code below be modified to search for the songs in the folder as well as the excel document and separate them by albums and into the subfolders 1 - HGH - Tonic(Script), 2 - LOW - Legat(Pause) which are also folders from combined values in the same spreadsheet? Thanks

for root, dirs, files, in os.walk( 'C:\\Users\\mrdrj\\Desktop\\NASB - Copy\\' ): # Location of Songs

for name in files: # List of Songs in Folder

for songnmz in sngnms: #List of Corrected Songs in Excel

if name.find(songnmz) and albmz = = 'NT' :

print (name)
I have included the link https://github.com/giddyhead/MoveFilesExcel.git for reference. Thanks for you time.

the shutil function. move () moves a file or directory (and its contents) to another location and returns the path of the new destination.

Thanks for the information. I was going to use shutil function but I was having an issue with the for loops as when I do the print out it does produce the required outcome for to move the correct files to the folders.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.