[PyQt] Copying Directory structure from a template one

Demetrius Cassidy dcassidy36 at mass.rr.com
Wed Apr 8 16:24:42 BST 2009


I must admit I am not very familiar with QDirModel, but why not use os.walk?

 #top would be the root directory you are begining your search at.
  def _walkDirPath(self, top):
        for dirpath, dirnames, filenames in os.walk(top):
            for name in filenames:
                # yields: c:\mydata\myfile.exe
                yield os.path.join(dirpath, name), name 

----- Original Message ----- 
From: "F.A. Pinkse" <fapinkse at gmail.com>
To: <pyqt at riverbankcomputing.com>
Sent: Wednesday, April 08, 2009 10:52 AM
Subject: [PyQt] Copying Directory structure from a template one


> Hello All,
> 
> For very new job in my CAD work I make a copy of an old Job Directory 
> structure and rename the directories/files as needed by hand.
> Finally I decided to throw Python at it.
> I hard coded the structure, but I felt I could do better, like copying a 
> template and do a rename in the process.
> But somehow I got stuck.
> 
> Here is what I did so far.
> 
> Used the QDirModel(), giving me the whole file system.
> Using filters will narrow this down, right?
> I can do a .hasChildren(), but I fail on the . findChildren() bit which 
> is needed for navigation, I think.
> 
> 
> Has anyone a good source of examples on this.
> 
> Thanks,
> 
> 
> Frans.
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


More information about the PyQt mailing list