[Tutor] How can I copy files recursively?

Alan Gauld alan.gauld at freenet.co.uk
Tue Jul 11 22:34:37 CEST 2006


>> Or you could just use mv on the top level folder.
>>
> But I don't want the sub folders to come along with the copy. I'd 
> like to
> grab the mp3 files out of a set of subfolders and place them all 
> into a
> single folder somewhere else.

Ah, sorry, I misunderstood the question.

In that case os.walk and shutil.copy provide a fairly easy solution.
Take a look at the findfile() function in the OS tutor topic.

Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list