FileCopy Error 52 Bad FileName or number

M

Marco Alting

Hi

I'm trying to copy a file from a source to a destination, but whatever I
try, I get error 52 bad filename or Number. I use Filecopy and a generated
string as destination, here's an example:

Source = "D:\Projecten\Shell\SPDC\EDMS\test.txt"
Destination = "D:\Projecten\Shell\SPDC\EDMS\test\DEE\DMP\CodeB\test.txt"

FileCopy SourceFile, DestinationFile


Can anyone tell me what I'm doing wrong here?


Thanks
 
D

Dave Lett

Hi Marco,

You haven't defined the SourceFile or DestinationFile parameters that you
use for the FileCopy statement.

Try the following:

SourceFile = "D:\Projecten\Shell\SPDC\EDMS\test.txt"
DestinationFile = "D:\Projecten\Shell\SPDC\EDMS\test\DEE\DMP\CodeB\test.txt"

FileCopy SourceFile, DestinationFile


HTH
 
M

Marco Alting

Dave

I did difine the SourceFile and DestinationFile in the two lines above the
FileCopy line

Marco
 
D

Dave Lett

Hi Marco,

Was the sample code you provided an exact copy? In the code you provided

Source = "D:\Projecten\Shell\SPDC\EDMS\test.txt"
Destination = "D:\Projecten\Shell\SPDC\EDMS\test\DEE\DMP\CodeB\test.txt"
FileCopy SourceFile, DestinationFile

you defined Source and Destination, but not SourceFile and DestinationFile.

If the sample code you provided is not an exact copy, can you provide one?

HTH
 
M

Marco Alting

Hi Dave,

I misspelled my code in the example, it should be like this:

SourceFile = "D:\Projecten\Shell\SPDC\EDMS\test.txt"
DestinationFile = "D:\Projecten\Shell\SPDC\EDMS\test\DEE\DMP\CodeB\test.txt"
FileCopy SourceFile, DestinationFile
 

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