[Tutor] recursive using the os.walk(path) from the os module

Alan Gauld alan.gauld at btinternet.com
Thu Sep 18 09:50:58 CEST 2008


"A. Joseph" <joefazee at gmail.com> wrote

> I want to search through a directory and re-arrange all the files 
> into e.g
>
> All .doc files go into MS WORD folder, all .pdf files goes into PDF 
> Folder.
>
> I`m thinking of doing something with the os.walk(path) method from 
> os

Which aspect is puzzling you? The use of os walk to traverse the
folders? Or the algorithm to put the files into new folders?

In either case you might get the answer in my Using the OS topic in
my tutorial.

Otherwise try posting a bit more detail on what you need.

Thanks,

-- 
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