3 Comments
User's avatar
Oleg's avatar

Thank you for this code and inputs of other folks!!!

I have a few more Questions:

I would like to organize my audio music files (they have different extensions and in different folders on C drive and in the cloud)

What if you have duplicate files, how do you handle them? How about putting those duplicates in a separate folder to address it later

Secondly, what if then I would like to organize the files by bands or any other classification? How do I do it en mass?

Thirdly, is there a way to get a list of all Song names I would compile and the band names

In other words, I almost want to have the program scan my whole computer, all folders that may have MP3 and WAV format files and consolidate those into that one folder, with which then I can work

Thank you for your ideas!

Expand full comment
Ardit Sulce's avatar

Hi Oleg, you can first remove duplicate files. We have a project on that:

https://open.substack.com/pub/dailypythonprojects/p/remove-duplicate-files-with-python

Then, try to see it you can get the band information in the file metadata. We also have a project on that: https://open.substack.com/pub/dailypythonprojects/p/file-metadata-extractor

Expand full comment
Gabriel Ovidor's avatar

import glob

import shutil as sh

import os

txt = r'C:\Users\GabrielDados\Desktop\TextFiles'

img = r'C:\Users\GabrielDados\Desktop\ImgFiles'

def make_directory(txt, img):

if not os.path.exists(txt):

os.mkdir(txt)

if not os.path.exists(img):

os.mkdir(img)

make_directory(txt, img)

def move_files():

files_txt = glob.glob(r'C:\Users\GabrielDados\Desktop\arquivos\**\*.txt', recursive=True)

files_png = glob.glob(r'C:\Users\GabrielDados\Desktop\arquivos\**\*.jpg', recursive=True)

files_jpg = glob.glob(r'C:\Users\GabrielDados\Desktop\arquivos\**\*.png', recursive=True)

for file in files_txt:

sh.move(file, r'C:\Users\GabrielDados\Desktop\TextFiles')

for file in (files_png):

sh.move(file, r'C:\Users\GabrielDados\Desktop\ImgFiles')

for file in (files_jpg):

sh.move(file, r'C:\Users\GabrielDados\Desktop\ImgFiles')

move_files()

Expand full comment