PDA

View Full Version : CopyFile() question



NewsArchive
12-05-2001, 01:00 AM
Hello-- In the script of my basic project in IS Dev 7.01, I'm checking for
the existence of some files on the end-user's system in the INSTALLDIR. If
the files exist, then I'm creating a directory inside their current
directory called "update" and copying those files there, then deleting them
from INSTALLDIR. I run seven iterations of this process, six of which
include wildcards -- for example:

CopyFile ( INSTALLDIR+"*.exe", INSTALLDIR+"update")

This works fine. However, the other situation is where a I copy a specific
filename over -- eg. myfile.txt.

I tried this: --it doesn't work.
CopyFile ( INSTALLDIR+"myfile.txt", INSTALLDIR+"update")

I tried this: --it doesn't work.
CopyFile ( INSTALLDIR+"myfile.txt", INSTALLDIR+"update\myfile.txt")

BUT, if I do something like this:
CopyFile ( INSTALLDIR+"myfile.tx?", INSTALLDIR+"update")
....that works fine.

How can I just grab that ONE file by name and copy it? In the two examples
above that DON'T work, the file DOES exist, I don't get any error message,
etc -- it just doesn't copy it. When I use the wildcard, it works fine.
Can someone enlighten me? Thanks in advance!

Regards,

Troy Miller
tmiller@dis1.com

NewsArchive
12-05-2001, 01:00 AM
What is the return code for your call to CopyFile()? Also, I believe the
value of INSTALLDIR will already end in a "\" appended to the end of it, but
to be sure, use the Append to Path operator "^" instead of the "+" when
building paths. This will automatically take care of appending the "\" to
the end of the path if it is not already there. It may not be the cause of
your issue, but it's good practice to follow.

--
Martin
InstallShield Software Corp.

"Troy A. Miller" <tmiller@dis1.com> wrote in message
news:3c0e9073@news.installshield.com...
>
> Hello-- In the script of my basic project in IS Dev 7.01, I'm checking for
> the existence of some files on the end-user's system in the INSTALLDIR.
If
> the files exist, then I'm creating a directory inside their current
> directory called "update" and copying those files there, then deleting
them
> from INSTALLDIR. I run seven iterations of this process, six of which
> include wildcards -- for example:
>
> CopyFile ( INSTALLDIR+"*.exe", INSTALLDIR+"update")
>
> This works fine. However, the other situation is where a I copy a
specific
> filename over -- eg. myfile.txt.
>
> I tried this: --it doesn't work.
> CopyFile ( INSTALLDIR+"myfile.txt", INSTALLDIR+"update")
>
> I tried this: --it doesn't work.
> CopyFile ( INSTALLDIR+"myfile.txt", INSTALLDIR+"update\myfile.txt")
>
> BUT, if I do something like this:
> CopyFile ( INSTALLDIR+"myfile.tx?", INSTALLDIR+"update")
> ...that works fine.
>
> How can I just grab that ONE file by name and copy it? In the two
examples
> above that DON'T work, the file DOES exist, I don't get any error message,
> etc -- it just doesn't copy it. When I use the wildcard, it works fine.
> Can someone enlighten me? Thanks in advance!
>
> Regards,
>
> Troy Miller
> tmiller@dis1.com
>
>
>
>

NewsArchive
12-06-2001, 01:00 AM
"Troy A. Miller" <tmiller@dis1.com> wrote in message
news:3c0e9073@news.installshield.com...
>
> I tried this: --it doesn't work.
> CopyFile ( INSTALLDIR+"myfile.txt", INSTALLDIR+"update\myfile.txt")

Did you try :

CopyFile ( INSTALLDIR+"myfile.txt", INSTALLDIR+"update\\myfile.txt")

HTH
Kathy

NewsArchive
12-06-2001, 01:00 AM
"Troy A. Miller" <tmiller@dis1.com> wrote in message
news:3c0e9073@news.installshield.com...
>
> I tried this: --it doesn't work.
> CopyFile ( INSTALLDIR+"myfile.txt", INSTALLDIR+"update\myfile.txt")

Did you try :

CopyFile ( INSTALLDIR+"myfile.txt", INSTALLDIR+"update\\myfile.txt")

HTH
Kathy

NewsArchive
12-06-2001, 01:00 AM
Better yet try:

CopyFile ( INSTALLDIR^"myfile.txt", INSTALLDIR^"update\\myfile.txt")

The "^" automatically adds "\\" when required, whereas + does not.

Hope this helps,
Mike Marino


"Kathy Morey" <KMorey@SERmacrosoft.com> wrote in message
news:3c0f881d$1@news.installshield.com...
>
> "Troy A. Miller" <tmiller@dis1.com> wrote in message
> news:3c0e9073@news.installshield.com...
> >
> > I tried this: --it doesn't work.
> > CopyFile ( INSTALLDIR+"myfile.txt", INSTALLDIR+"update\myfile.txt")
>
> Did you try :
>
> CopyFile ( INSTALLDIR+"myfile.txt", INSTALLDIR+"update\\myfile.txt")
>
> HTH
> Kathy
>
>