Help Needed. Removing a Folder Problem(Problem Solved)

Steve Holden steve at holdenweb.com
Thu Jul 20 14:02:53 EDT 2006


Kilicaslan Fatih wrote:
[...]
> Dear All,
> 
> I changed the mode of the files before copying them.
> So the problem is solved as follows:
> 
> SOLUTION:
> 
> def runCCCC(self, event):
>         cmd_out = self.A_com()
>         if App.runF != "":
>             os.mkdir('C:\copiedFiles')                
>       
>             for item in App.runF:
>                 os.chmod(item, 0700)
>                 shutil.copy(item, 'C:\copiedFiles')   
>           
>             cmd = 'cccc C:\copiedFiles\*.*' + cmd_out
>             os.system(cmd)
>             for root,dir,files in
> os.walk("C:\copiedFiles"):
>                           
>             shutil.rmtree('C:\copiedFiles')
>         else:
>             tkMessageBox.showinfo("Window Text",
> "Please Firstly Browse and Insert A File")    
> 
Just be careful with those string constants: you should really be using 
either 'C:\\copiedFiles' or r'C:\copiedFiles'. No problems at the moment 
because "\c" isn't a defined escape sequence, but if your directory name 
had begun with a "t", for example, you'd have got a tab after the colon.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list