WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Error Codes

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

1009 Error using FileCopy

Keywords:  error 1009

Question:

I am getting a 1009 error from WinBatch when I try to do a FileCopy. I can copy the file with no problems using Windows. I am working on an application to create a backup copy of files from another PC to a server.

I get this to I've tried debug(1) it hangs at File copy.


FileCopy: FROM file open failed
winbatch 32 97B
WIL Version:2.4bbp
I no its' not the script it worked fine for 1 3/4 years till put win98.then all my filecopy("Stopped", "Working") sometimes get

Error 1008
Error 1009
Error 1010 FileCopy: FROM file open failed
...Most have FILE open failed somewhere in error line. Here's my code:

	FileCopy("C:\autoexec.bat", "C:\*.bak")
	a=C:\"autoexec.bat"
	b=C:\"autoexec.bak"
	FileCopy(a,b,);will not work
Any suggestions on how to get around this problem?

Answer:

The FROM file is bad. I suspect a simple error in the scipt in specifying the file name. It could be that the file is "busy" at that instant.

1009 indicates the script does not like the source file. The problem may revolve around doing a FileItemize on a non-current directory, and then not prepending that directory to the file name in the generation of the currfile variable. Check that.

The list of filenames returned by FileItemize does not include pathnames. If you are working with anyting other than the current path, then your script must take this into account.

I tried:


FileCopy("C:\autoexec.bat", "C:\*.bak",0)
FileCopy("C:\autoexec.bat", "C:\autoexec.bak", @false)
Message("It","Worked")
It seems to work perfectly under windows 98.

None of the examples you provided could possibly work.


filecopy("Stopped", "Working")
Missing third parameter

FileCopy("C:\autoexec.bat", "C:\*.bak")
FileCopy("C:\autoexec.bat", "C:\autoexec.bak", @false)
First FileCopy missing third parameter

a=C:\"autoexec.bat"
b=C:\"autoexec.bak"
FileCopy(a,b,);will not work
Double quotes for a and b variables misplaced.

FileCopying Shortcut LNK Files Info:

Question:


PhonePath="M:\CSS32\CSS\tools\Script"
PhoneEXE="PhoneLst.lnk"
FileCopy("%PhonePath%\%PhoneEXE%","%Profiles%\%User%\DeskTop\%CSSWork%\Tools\Admin\CSSP Phone List.LNK", @False)
Can you tell my why this doesn't work? I am copying a shortcut that is not in use. The access database the shortcut is referencing is and will be in use. The shortcut properties for the PhoneEXE=PhoneLst.lnk are as follows:

M:\WIN32\OFFICE\OFF97SR1\SERVER\MSOFFICE\OFFICE\MSACCESS.EXE "S:\Production Facing Team\PR Batch\Transitioning\ShiftOps\TrainTrax.mdb" /x AltOpen.
I can execute from a manually created shortcut just fine. I am doing a file copy because if I don't, winbatch automatically puts quotes around the target path specifying msaccess with paramters because that's how windows normally likes it, but it doesn't work with the quotes. Doing a shortcutmake I also get the problem of being greater than 256 chars.

Why doesn't the file copy work?

Answer:

  1. When you try a FileCopy with a lnk file, windows automagically tries to work through the shortcut and copy the file that is being pointed to, not the lnk file itself.

    I presume the pointed to file is not installed yet and thus the filecopy fails.

    LNK files take special handling as in many cases the target file is used instead of the lnk file itself.

  2. Make sure you have the correct name for the LNK file. In Explorer, you will not be able to see the LNK file extension, so you need to go into DOS to see what the file name actually is. If you created a shortcut to an exe, such as Winbatch.exe, the shortcut file would actually be named WINBATCH.EXE.LNK. So that's the filename you need to specify in the first parameter of the FileCopy function.

Article ID:   W12930
Filename:   1009  FileCopy FROM File Open Failed.txt
File Created: 2001:01:25:15:52:24
Last Updated: 2001:01:25:15:52:24