This is a simple script for moving my MP3 files from one directory to another. I'd like to know if there is a more efficient way to handle my task in the script. I analyzed the algorithm to be \$O(n^2)\$.
import os
import shutil
import re
files = os.listdir(os.path.dirname('/home/rich/Downloads/'))
regex = r"(.mp3)"
for f in files:
if (re.search(regex, f)):
f = os.path.join('/home/rich/Downloads/', f)
shutil.move(f, '/home/rich/Music/Songs/')