"""there is threee directories,one of these is used for the base
directory,decided by the user, default is d0"""
import shutil
#the three directories
d0='D:/Program Files/eb/mb/S'
d1='O:/eb/mb/S'
d2='P:/S/eb/mb/S'
#to backup
def update(base):
l=[d0,d1,d2]
l.remove(base)
for i in l:
shutil.rmtree(i)
for i in l:
shutil.copytree(base,i)
#use the base directory to invoke the update() func
def updateNow(base):
try:
if base=='d1':
update(d1)
elif base=='d2':
update(d2)
else:
update(d0)
except:
print "sth is wrong"
else:
print "OK!"
#promt user which is the base
if __name__ == '__main__':
print 'd0=',d0
print 'd1=',d1
print 'd2=',d2
base=raw_input("your base/standard directory is d0 d1 or d2 ?\n")
print base
updateNow(base)
raw_input('press Return>') 6 1194
On Fri, 31 Mar 2006 18:37:11 -0800, obeeker wrote: """there is threee directories,one of these is used for the base directory,decided by the user, default is d0"""
[snip code]
It doesn't work? Have you tried running it to see what it does? When you
do, please post a description of what it does, including any exception
tracebacks, and just as importantly, what you expect it to do.
--
Steven.
thank you for your suggestion and apologize for my mistake.
if i run it and answer the raw_input with "Enter" i get
sth is wrong
press Return>
i comment the try-except and run it and answer the raw_input with
"Enter"
and get message following:
Traceback (most recent call last):
File "G:\9\Eb\updateEbBb.py", line 41, in -toplevel-
updateNow(base)
File "G:\9\Eb\updateEbBb.py", line 28, in updateNow
update(d0)
File "G:\9\Eb\updateEbBb.py", line 16, in update
shutil.rmtree(i)
File "D:\Program Files\Python24\lib\shutil.py", line 155, in rmtree
onerror(os.listdir, path, sys.exc_info())
File "D:\Program Files\Python24\lib\shutil.py", line 153, in rmtree
names = os.listdir(path)
WindowsError: [Errno 3] : 'O:/eb/mb/SCIL/*.*'
please don't read the prevous post ,please read this one:
thank you for your suggestion and apologize for my mistake.
if i run it and answer the raw_input with "Enter" i get
sth is wrong
press Return>
i comment the try-except and run it and answer the raw_input with
"Enter"
and get message following:
Traceback (most recent call last):
File "G:\9\Eb\updateEbBb.py", line 41, in -toplevel-
updateNow(base)
File "G:\9\Eb\updateEbBb.py", line 28, in updateNow
update(d0)
File "G:\9\Eb\updateEbBb.py", line 16, in update
shutil.rmtree(i)
File "D:\Program Files\Python24\lib\shutil.py", line 155, in rmtree
onerror(os.listdir, path, sys.exc_info())
File "D:\Program Files\Python24\lib\shutil.py", line 153, in rmtree
names = os.listdir(path)
WindowsError: [Errno 3] : 'O:/eb/mb/S/*.*' ob*****@gmail.com wrote: please don't read the prevous post ,please read this one:
thank you for your suggestion and apologize for my mistake. if i run it and answer the raw_input with "Enter" i get
sth is wrong press Return>
i comment the try-except and run it and answer the raw_input with "Enter" and get message following:
Traceback (most recent call last): File "G:\9\Eb\updateEbBb.py", line 41, in -toplevel- updateNow(base) File "G:\9\Eb\updateEbBb.py", line 28, in updateNow update(d0) File "G:\9\Eb\updateEbBb.py", line 16, in update shutil.rmtree(i) File "D:\Program Files\Python24\lib\shutil.py", line 155, in rmtree onerror(os.listdir, path, sys.exc_info()) File "D:\Program Files\Python24\lib\shutil.py", line 153, in rmtree names = os.listdir(path) WindowsError: [Errno 3] : 'O:/eb/mb/S/*.*'
shutil.rmtree() expects a directory name, not a file pattern. if you leave
out the "*.*" part at the end, it should do what you want.
(assuming you want to remove the eb/mb/S directory, that is)
</F>
i am very sorry .
the erroer was from my Portable Hard Disk
because its disk sign has changed from "o" to "h" ,from "p" to "i"
i'm very sorry
I wrote: WindowsError: [Errno 3] : 'O:/eb/mb/S/*.*'
shutil.rmtree() expects a directory name, not a file pattern. if you leave out the "*.*" part at the end, it should do what you want.
postscript: typically enough, I stumbled upon the same error message myself,
a day later. looks like it's Windows that adds the "*.*" thing to the path, all
by itself.
however, on my machine, I get a bit more information:
WindowsError: [Errno 3] The system cannot find the path specified:
'directory/*.*'
</F> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Chewy509 |
last post by:
Hi Everyone,
I'll just start, and say I am not a PHP developer (I'm a sysadmin, who
has gotten lumped with a non-working website). But since I like to do
this type of stuff, I though I might...
|
by: Paul O. Morris |
last post by:
Is there a script that I can run to stop a particular SQL server service on
Win2003 server? I'm looking for a similar script to restart that service as
well. Thanks.
|
by: Luc Le Blanc |
last post by:
I'm trying to restore a backup from a DMS DB2/2 database. The original
DB has 3x 1Gb containers in the user tablespace. So the backup has 3
files, bearing the time of the backup as file name, with...
|
by: Steven |
last post by:
I have a problem with moving the backup of my database from machine to
machine. The size is 17 Gig and my network keeps timing out when I try
to ftp it from machine to machine. I have had the...
|
by: microsoft . public . sqlserver |
last post by:
I am using SQL server 7.0. After restoring all the databses (Except
distribution) Everything seems to be working fine except the backup
maintenance plan. I put following detail in the maintenance...
|
by: dcruncher4 |
last post by:
DB2 8.2.3
the task I have is to write a script to restore a database from a
backup on to another machine.
the backup can be as old as seven years. The container layout on the
machine to be...
|
by: george.zhang |
last post by:
Hi, Friends,
I have oneconcern on my stragety on db2 backup.
My db2 databse backup imdage with size 100G.
On the server, it has two directories which I can use to backup:
directory a with 30 G...
|
by: imtmub |
last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted.
Check this page for reference....
|
by: cmrchs |
last post by:
Hi,
I have in my web application project (VS.NET 2008) :
- a webform (webform2.aspx, webform2.aspx.cs,
webform2.aspx.designer.cs)
- a code-file Product.cs.
But i can't use the definition of...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |