[Tutor] filename comparison

mhysnm1964 at gmail.com mhysnm1964 at gmail.com
Tue Jan 11 05:34:59 EST 2022


All,

 

Problem Description: I have over 8000 directories. In each directory there
is a text file and a MP3 file. Below is the file naming structure for an MP3
or text file:

 

Other Mother plot.txt

Other Mother.mp3

 

What should occur:

*	Each directory should have both the above two files. 
*	There can be multiple MP3 and text files in the same directory.
*	I want to find out which directories do not have a  plot text file
associated to the already existing mp3 file.
*	I want to find out which plot text file does not have a mp3 file.

 

I have already managed to walk the directory structure using os.walk. But I
am struggling with the best method of comparing the existing files.

 

Anyone have any ideas how to approach this problem? As I am completely stuck
on how to resolve this.

 

Sean 



More information about the Tutor mailing list