PDA

View Full Version : Filecopy action



jammer2
04-16-2005, 10:57 AM
I can't get filecopy to copy my file to a destination directory, here's the action
File.Copy("AutoPlay\\Docs\\BPFTP.REG", "C:\\DestDir\\program\Program Files\BPFTP", true, true, false, true, nil);

Intrigued
04-16-2005, 11:32 AM
I can't get filecopy to copy my file to a destination directory, here's the action
File.Copy("AutoPlay\\Docs\\BPFTP.REG", "C:\\DestDir\\program\Program Files\BPFTP", true, true, false, true, nil);

Right off I see you started out with proper path syntax "\\". But, as you can see in the second argument... you missed a couple "\"

Try:

File.Copy("AutoPlay\\Docs\\BPFTP.REG", "C:\\DestDir\\program\\Program Files\\BPFTP", true, true, false, true, nil);

TJ_Tigger
04-16-2005, 02:41 PM
You will also want to ensure that the destination directory exists.

Tigg

jammer2
04-16-2005, 08:11 PM
You will also want to ensure that the destination directory exists.

Tigg
It does exist

Eagle
04-16-2005, 08:24 PM
File.Copy(_SourceFolder.."\\AutoPlay\\Docs\\BPFTP.REG", "C:\\DestDir\\program\\Program Files\\BPFTP\\BPFTP.REG", true, true, false, true, nil);

Intrigued
04-17-2005, 01:17 AM
File.Copy(_SourceFolder.."\\AutoPlay\\Docs\\BPFTP.REG", "C:\\DestDir\\program\\Program Files\\BPFTP\\BPFTP.REG", true, true, false, true, nil);

In this situation.. the _SourceFolder built-in is not necessary. But, it definitely is good programming practice!

:yes

jammer2
04-17-2005, 03:03 AM
Sorry guys this does'nt copy bpft.reg to C:\Program Files\BPFTP

File.Copy("AutoPlay\\Docs\\BPFTP.REG", "C:\\DestDir\\program\\Program Files\\BPFTP\\BPFTP.REG", true, true, false, true, nil);

Eagle
04-17-2005, 03:08 AM
as it is..it can't Jammer..

the 'destination path' needs to be correct..you have other 'path folders'
in your action...we just gave you correct 'syntax for your supplied path.

lets know if still stuck..

try this:


File.Copy(_SourceFolder.."\\AutoPlay\\Docs\\BPFTP.REG", "C:\\Program Files\\BPFTP\\BPFTP.REG", true, true, false, true, nil);

you need to have the exact folder path and as Tigger sugggested..
all folders in the path Must be correct and exist Before any file copy actions.

jammer2
04-17-2005, 04:37 AM
as it is..it can't Jammer..

the 'destination path' needs to be correct..you have other 'path folders'
in your action...we just gave you correct 'syntax for your supplied path.

lets know if still stuck..

try this:


File.Copy(_SourceFolder.."\\AutoPlay\\Docs\\BPFTP.REG", "C:\\Program Files\\BPFTP\\BPFTP.REG", true, true, false, true, nil);

you need to have the exact folder path and as Tigger sugggested..
all folders in the path Must be correct and exist Before any file copy actions.
Ok, that worked Eagle, Thanks for the help

jammer2
04-17-2005, 05:08 AM
as it is..it can't Jammer..

the 'destination path' needs to be correct..you have other 'path folders'
in your action...we just gave you correct 'syntax for your supplied path.

lets know if still stuck..

try this:


File.Copy(_SourceFolder.."\\AutoPlay\\Docs\\BPFTP.REG", "C:\\Program Files\\BPFTP\\BPFTP.REG", true, true, false, true, nil);

you need to have the exact folder path and as Tigger sugggested..
all folders in the path Must be correct and exist Before any file copy actions.
I wish I knew or understood what the double back slashes in the destination path does and where thats listed somewhere. On my own I would never had even tried that.

Stefan_M
04-17-2005, 06:04 AM
if you want to copy files into the program files folder use
_ProgramFilesFolder .. "\\BPFTP\\BPFTP.REG"
instead of
"C:\\Program Files\\BPFTP\\BPFTP.REG"

Its more flexible to use "Global variables" rather then absolute paths.

See Onlinehelp:
"Program Reference - Variables" Overview,Global Variables
"Scripting Guide - Variables - Types and Values" String



Stefan_M

jammer2
04-17-2005, 04:37 PM
Ok thanks for the info Stefan_M
I appreciate it.