Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Foxpro 2.6 Copy File Access Denied Win7

Status
Not open for further replies.

bjitima

Technical User
Dec 29, 2004
63
US
We have added some Windows 7 computers to our network and haven't had too much trouble running our older Foxpro 2.6 software on them. However, we recently ran into a problem where we were trying to backup our DBF files weekly. When we try to do

copy file backup.zip to \\win7pc\backup\backup.zip​

we receive a File Access Denied error message within Foxpro. However, I can do a normal copy command in a CMD window and the file goes with no problems, which leads me to believe that my file sharing permissions are correct. I also tried right clicking CMD and using Run As Administrator, then starting Foxpro and issuing the command, still with the same results. To keep the backup running, we changed the destination to a Windows XP computer, but as we phase out Windows XP, this will likely begin to pose a bigger problem.

Does anyone have any suggestions on what to try next?

Ben
 
First question for better clarification...

You added some Windows 7 workstations to your network, but your backup is attempting to write to a directory on a Central Server (where your data tables reside) running some other OS (non-Win7).
Correct?

Maybe we can get to a better suggestion with more understanding.

Good Luck,
JRB-Bldr





 
Second question (which I should have asked as part of the above post)...

Is there any difference when your backup is run on one of the WinXP workstations versus being run on one of the Win7 workstations?

Good Luck,
JRB-Bldr
 
How are you zipping? Several solutions in VFP work asynchronous, that means in parallel. So you zip, then copy, but zipping is still in progress. As simple as that, of course that won't work.
In other word: What file can't be accessed? Must be the source zip file, mustn't it? You don't access the destination zip file,you create it, you could only have insufficient write permission. Caution: The "Anyonoe" user is a local, not a domain user, so it's insufficient to allow write access to a share to "Anyone". Create User Groups and add domain users.

Bye, Olaf.
 
Another suggestion: Map the share on each client doing a copy file, this enforces you to answer some questions and configure access rights.

Bye, Olaf.
 
The program is running on a Windows 2003 R2 SP2 server. The server is where the .DBFs reside. We are shelling to DOS and running PKZIP. Then we copying the .ZIP files to two different network PCs in different buildings for redundancy. If we copy to a Windows XP computer, we have no problem. If we copy to a Windows 7 computer, we receive File Access Denied. Here is the code that we are using:

mfiledbf="b_dbf"+left(cdow(date()),3)."zip"
&&Setting the backup file name for the day of the week, IE b_dbfWED.zip​
! pkzip -m d:\bakup\&mfiledbf \bakup\*.dbf > nul
&&Shelling to DOS to zip the .DBFs​
@ 11,20 say "Copying Backup to Other Computer"
&&Display​
copy file d:\bakup\&mfiledbf to c:\bakup\&mfiledbf
&&Making local copies on both the C and D drives​
copy file d:\bakup\&mfiledbf to \\wh01\c\bakup\&mfiledbf
&&Making a copy on a Windows XP computer in our warehouse​
copy file d:\bakup\&mfiledbf to \\charlesdesk\c\bakup\&mfiledbf
&&Making a copy on a Windows 7 computer in our office​

\\charlesdesk is a Windows 7 computer. When we change that path is set to a Windows XP computer, the code works with no problem and has for years. Only when the backup destination is Windows 7 do we get File Access Denied. I thought perhaps it was a problem with the Windows 7 destination having file sharing rights incorrect, so that was when I opened an elevated CMD window and did a "copy d:\bakup\b_dbfwed.zip \\charlesdesk\c\bakup" and it worked fine. I deleted the destination file, ran foxprox.exe, and then did the "copy file d:\bakup\b_dbfwed.zip to \\charlesdesk\c\bakup\b_dbfwed.zip" and again received File Access Denied.
 
Well, you're confirming what I suspected.
Running an extrrnal EXE to zip, you need to wait until zipping is really done and all file handles are closed, before you begin to copy. I understand you don't use the /N nowait flag for !/Run, still pkzip might return and have file handles open, that only vanish after some time, especially with multi core systems.

After the ! pkzip line wait for exclusive file access with
Code:
lnFH = -1
While lnFH < 0 
   lnFH = FOPEN("d:\bakup\"+mfiledbf,12)
   DoEvents
Enddo
FCLOSE(lnFH)

Only after that copy. Try it.
The loop is getting exclusive file access (12) and after that you can be sure VFP can access the file.

Bye, Olaf.
 
copy file backup.zip to \\win7pc\backup\backup.zip

Old FoxPro can't handle UNCs very well if at all. Yes, you'll still have to wait for the zip process to finish, but you should still be able to do a COPY FILE to a mapped drive.
Try mapping say, drive 'G:' to '\\charlesdesk\c\bakup'.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
I don't think that the timing is the issue, because I went directly into Foxpro and issued JUST the copy file command with a previously existing file and still received the File Access Denied error. I also tried it with the drive mapped instead of a UNC path and also got the error.
 
The main question still is, wheter access is denied in reading the source or writing in the destination folder. Is a file with same name preexisting in \\charlesdesk\c\bakup\ ?

Bye, Olaf.
 
Is your command prompt running with elevated privileges?
Are you able within FoxPro to create or even update an already created table on the Windows 7 box?

It may not be the copy command. You may simply not have sufficient rights.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Try creating the a same user/password on the Win7 PC with admin priviledges. Then try copying. If works then tweak the privileges as required. Otherwise try

run copy my.zip \\win7pc\backupdir\backup.zip

Also make sure the file does not exist on the destination Win7 PC.

Nasib

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top