Solved

File copy error 75

Posted on 2000-04-17
12
343 Views
Last Modified: 2010-08-05
I am having problems copying a file locally.  What happens is, we have a piece of software which creates the JRN files in the CashDir.  It copies files to the ServerFile.  This copies OK but when it copies it from the CashDir to LocalDir it fails.  To put these variable names into context, the ServerFile is a directory on a server and the CashDir is, as I said, a local location where the file resides until this code is run.  The LocalDir is also a local directory which is a subfolder of CashDir.


Private Sub Timer1_Timer()

Dim JRNFile As String, ServerFile As String, Log As String, Destination As String

On Error GoTo ErrorHandler

'Label1 = Counter

If Counter <> 60 Then    ' SET BACK TO 60
    Counter = Counter + 1
    Exit Sub
End If

Counter = 1

File = LocalDir & "\" & "Backup.log"
Open File For Append As #2

'Download updates from server - **NOT CURRENTLY USED**

'File = UpdateDir & "/*"
'UpdFile = Dir(File)

'Do While UpdFile <> ""
'    ServerFile = UpdateDir & "/" & UpdFile
'    LocalFile = Updates & "/" & UpdFile
'    FileCopy ServerFile, LocalFile
'    Log = UpdFile & " updated " & Now
'    Print #2, Log
'    UpdFile = Dir
'Loop

'Get the journal files one by one and if they are not todays files
'then copy them to the server and to the save directory then
'delete the origninals.  All this is logged in Backup.log

File = CashDir & "\*.JRN"
JRNFile = Dir(File)

'Label2 = "Transferring ..."
DoEvents

Do While JRNFile <> ""
    If JRNFile <> TodaysFile Then
        Print #2, "Copying " & JRNFile
        Infile = CashDir & "\" & JRNFile
        ServerFile = ServerDir & "\" & Position & "\" & JRNFile
        Localfile = LocalDir & "\" & JRNFile
        Destination = ServerFile
        FileCopy Infile, ServerFile
        Log = JRNFile & " copied to server at " & Now
        Print #2, Log
        FileCopy Infile, Localfile 'Fails here
        Log = JRNFile & " copied locally at " & Now
        Print #2, Log
        Kill Infile
        Log = JRNFile & " deleted at " & Now
        Print #2, Log
    End If
    JRNFile = Dir
Loop

'Label2 = ""

AfterError:

Close #2

On Error GoTo 0

Exit Sub

ErrorHandler:

Print #2, "Encounter Error" & Err

If (Err = 75) Or (Err = 76) Or (Err = 52) Then
    Log = "Failed to copy to " & Destination & " at " & Now
    Print #2, Log
    'Label2 = "Failed " & Err
    Resume AfterError
Else
    Log = "Error " & ErrCode & " occured at " & Now
    Print #2, Log
    End
    'Label2 = "Failed " & Err
End If

End Sub

I have tried recreating the exe and installing it again.
0
Comment
Question by:andcu
  • 6
  • 5
12 Comments
 

Author Comment

by:andcu
ID: 2723092
It would be useful to know that the filenames are made up from the physical position of the PC in this case 03 and then the date they were produced so.  If the file was created on the 10/04/2000 at computer 03 then the name would be 03100400.jrn
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 2723143
andcu, is there any possibility that localfile is open in another process? Or that if it is an NT box that there are permissions set which prevent the user accessing the folder?
0
 
LVL 32

Expert Comment

by:bhess1
ID: 2723474
My best bet is that LocalDir is either access protected, or the Variable name is formed incorrectly.  

Check the permissions on the LocalDir directory, and ensure that the variable LocalDir doesn't have a terminal backslash - FileCopy doesn't like names like 'C:\Logs\History\\03100400.log'
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 32

Expert Comment

by:bhess1
ID: 2723536
My best bet is that LocalDir is either access protected, or the Variable name is formed incorrectly.  

Check the permissions on the LocalDir directory, and ensure that the variable LocalDir doesn't have a terminal backslash - FileCopy doesn't like names like 'C:\Logs\History\\03100400.log'
0
 

Author Comment

by:andcu
ID: 2725763
I think the answers are no because:

1) The client machine is Windows 95.

2) It can be copied manually
0
 
LVL 32

Expert Comment

by:bhess1
ID: 2727405
But what is the actual value in the variable LocalDir?
0
 

Author Comment

by:andcu
ID: 2746631
LocalDir = c:\cashr\audit
cashdir = c:\cashr
0
 
LVL 32

Expert Comment

by:bhess1
ID: 2748366
This is a long shot, but try setting the Localfile variable manually, e.g.

  Localfile = "c:\cashr\audit\" & JRNFile

Does this work?
0
 
LVL 32

Accepted Solution

by:
bhess1 earned 200 total points
ID: 2748446
One other long shot, based on a vaguely remembered problem some years back:  Open your log file on a differently numbered channel.  Try #9.  If I recall correctly, the Filecopy uses a channel as well, and it may be conflicting.

0
 

Author Comment

by:andcu
ID: 2750517
All I can say is it worked.

I don't know about the other idea of hardcoding "c:\cashr\audit" because I didn't try it so apologies if your answer would have worked too.
0
 

Author Comment

by:andcu
ID: 2750525
Ahh!

That was lucky, I have just realised that both these suggestions came from you, bhess1.  That was lucky means you can have points for your time aswell as for your correct answer.
0
 
LVL 32

Expert Comment

by:bhess1
ID: 2751749
No problem - just glad I remembered the situation where that happened to me!
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA filters 2 61
Getting warning: You are about to delete 1 row(s) 9 48
SLMGR Switches Are Not Working On KMS Host 3 93
VB6 ListBox Question 4 44
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question