Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COPY FILE then ERASE causes File access denied.
Message
From
23/08/2007 14:41:59
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
COPY FILE then ERASE causes File access denied.
Miscellaneous
Thread ID:
01249989
Message ID:
01249989
Views:
70
Hi all,
Anyone experienced this problem before? We use Dynazip to create zip files from our application. Although, I think the problem does not have something to do with Dynazip, I am including it in the code snippet to hopefully, illustrate the problem clearly.

The problem occured when the server was upgraded from Windows 2000 to 2003. The rights are all relaxed including the Data Execution Protection (DEP) setting of the server. On the 2000 server, the error: "File access is denied" does not occur at all and the code hasn't been modified in years. However, our application provides an option to RETRY in our error handler and doing so after a few seconds will allow the ERASE command to work properly.

It seems that the COPY FILE has not totally released the lock on the source file when the ERASE command was executed. I will probably embed an INKEY(3,"HM") before the ERASE to allow a 3 seconds wait.

Aside from the INKEY() solution, is there any particular place I should look at the server?
cZipName='backup.zip'
cZipDir='u:\backup\'
cZipFile='d:\appdata\*.*'
cLongFileName='backup-on-'+dtoc(date())+'.zip'
with loZip
   .ActionDZ = 0
   .ZipFile         = cZipName       && the name you want to call the zip
   .ItemList        = cZipFile       && the path and file you want to zip
   .NoDirectoryNamesFlag = .t.
   .ExtProgTitle    = 'Zipping files in progress...'
   .ZipSubOptions   = 0x0004 && zip progressbar
   .ActionDZ        = 4 && start zipping
endwith
release loZip

if file(cZipDir+cLongFileName)
   erase cZipDir+cLongFileName
endif
* Copy the temporary zip file to the backup location.
copy file (cZipName) to (cZipDir)+(cLongFileName)
* Remove the temporary zip file after copying to another location.
if file(cZipName)
   erase (cZipName)  && ERROR: File access is denied.
endif
ramil
~~ learning to stand still
Next
Reply
Map
View

Click here to load this message in the networking platform