Yes, a batch file will copy the file as long as the file is open in shared
mode. Use Shell to run the batch file.
Example:
Shell "command.com /c <path>\copydb.bat", vbMinimizedNoFocus
Example batch file to keep 9 copies:
@echo off
if exist \\computer\HiddenShare$\*.* goto Begin
echo Destination not found
if not exist \\computer\HiddenShare$\*.* goto end
rem Replace the file that doesn't exist
rem If more that one doesn't exist the first
rem one that doesn't exist is the one to goto
:Begin
if not exist \\computer\HiddenShare$\*.1 goto one
if not exist \\computer\HiddenShare$\*.2 goto two
if not exist \\computer\HiddenShare$\*.3 goto three
if not exist \\computer\HiddenShare$\*.4 goto four
if not exist \\computer\HiddenShare$\*.5 goto five
if not exist \\computer\HiddenShare$\*.6 goto six
if not exist \\computer\HiddenShare$\*.7 goto seven
if not exist \\computer\HiddenShare$\*.8 goto eight
if not exist \\computer\HiddenShare$\*.9 goto nine
if not exist \\computer\HiddenShare$\*.10 goto ten
goto end
ne
copy \\server\database\MyDatabase*.md? \\computer\HiddenShare$\*.md?.1
if exist \\computer\HiddenShare$\*.2 del \\computer\HiddenShare$\*.2
goto end
:two
copy \\server\database\MyDatabase*.md? \\computer\HiddenShare$\*.md?.2
if exist \\computer\HiddenShare$\*.3 del \\computer\HiddenShare$\*.3
goto end
:three
copy \\server\database\MyDatabase*.md? \\computer\HiddenShare$\*.md?.3
if exist \\computer\HiddenShare$\*.4 del \\computer\HiddenShare$\*.4
goto end
:four
copy \\server\database\MyDatabase*.md? \\computer\HiddenShare$\*.md?.4
if exist \\computer\HiddenShare$\*.5 del \\computer\HiddenShare$\*.5
goto end
:five
copy \\server\database\MyDatabase*.md? \\computer\HiddenShare$\*.md?.5
if exist \\computer\HiddenShare$\*.6 del \\computer\HiddenShare$\*.6
goto end
:six
copy \\server\database\MyDatabase*.md? \\computer\HiddenShare$\*.md?.6
if exist \\computer\HiddenShare$\*.7 del \\computer\HiddenShare$\*.7
goto end
:seven
copy \\server\database\MyDatabase*.md? \\computer\HiddenShare$\*.md?.7
if exist \\computer\HiddenShare$\*.8 del \\computer\HiddenShare$\*.8
goto end
:eight
copy \\server\database\MyDatabase*.md? \\computer\HiddenShare$\*.md?.8
if exist \\computer\HiddenShare$\*.9 del \\computer\HiddenShare$\*.9
goto end
:nine
copy \\server\database\MyDatabase*.md? \\computer\HiddenShare$\*.md?.9
if exist \\computer\HiddenShare$\*.10 del \\computer\HiddenShare$\*.10
goto end
:ten
copy \\server\database\MyDatabase*.md? \\computer\HiddenShare$\*.md?.10
if exist \\computer\HiddenShare$\*.1 del \\computer\HiddenShare$\*.1
:end
--
Wayne Morgan
MS Access MVP
Daniel said:
Good morning,
Once again I need your help (another thing I don't know this is becoming a
little too frequent). Anyways...
I wrote an autoexecutable program to automatically backup my database's
back-end once a day using the FileCopy function. The problem is that is
only will work if nobody has the back-end open (hence, nobody is using the
database). Is there a way to copy it even if someone is currently using the
database?