folder access in "call shell..."

G

Guest

Hi.
Here is the code for a "backup" button

Private Sub buall_Click()

Call Shell("xcopy c:\dw\*.* H:\Dw\ /E /y")

Call Shell("xcopy h:\photo library\*.* H:\photo library\ /E
/y")

Call Shell("xcopy c:\darcy\graphics stuff\*.* H:\graphics
stuff\ /E /y")

End Sub

The first line runs OK but the other two don't

The backup external HDD (N:) is on/installed/working
The database is in c:\dw\

I have tried adding >backup.txt to the lines as I know that the volume of
data will take a while to copy (about 20gb). on the text file
C:backuplog.txt
C:dbase-menu-bg.bmp
C:help.bmp
C:krazydarcy-studiobase.ldb
C:krazydarcy-studiobase.mdb
C:logo--stensil copy.gif
C:logo--stensil.jpg
.....
All of the above files ARE in C:\dw\

Is access vba being sandboxed?
I want to be able to back up all three folders at the click of a button
I may end up using a batch file (.bat) and invoke that from the vb script.
But unsure if I will still hit the same problem.

Thanks for your time.
 
D

Douglas J. Steele

Because of the embedded spaces in the folder names, you need quotes around
the names. Note that to put a single double quote inside of a string, you
have to put two double quotes in a row:

Call Shell("xcopy ""h:\photo library\*.*"" ""H:\photo library\ /E /y""")

Call Shell("xcopy ""c:\darcy\graphics stuff\*.*"" ""H:\graphics stuff\ /E
/y""")
 
G

Guest

I have put the xcopy comand into a batch file and have got it to run for two
of the folders (2 of the xcopy commands).

I have discovered that the third is prematurly terminating because of a file
that causes a acess denied error in xcopy. I don't know why as I can
cut/paste it elsewhere. To discover this I first used a >buphotolib.txt on
the end of the xcopy command. This text file told me where the problem lied
not what it was. Then I had to enter the xcopy command in windows command
prompt window so I can see any error messages xcopy may give (call shell(...
doesn't give me a chance to read it.)

I hope this is the only file with this problem. Have just shifted it out and
will try the command again and see if it runs ok this time
 
D

DAVID

prematurly terminating because of a file
that causes a acess denied error in xcopy.

Perhaps you could use a 'copy' command instead of xcopy?
(copy does not require exclusive locks)

Sometimes you can't xcopy things because they
aren't really there: Windows explorer is not
refreashed, or the BIT service is still doing
something with the file.

(david)
 
M

missinglinq via AccessMonster.com

You're not, by any chance, trying to call all of this from the C:krazydarcy-
studiobase.mdb database, are you? I'm fairly certain you can't copy a db
while it's open.
 
G

Guest

Thanks guys.

The 1 1/2 dozen offending files were all .jpg's. So I manyally moved them to
a temp folder to "save as" in photoshop..

The way I went in the end was to call shell a .bat batch file which has the
xcopy commands in them. Each xcopy command generates a log text file So i
know it is working ok. I even use the /H /Y and for the changed/new files
backup a /D.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top