Copy file from network drive? 
Author Message
 Copy file from network drive?

Using CW2003.  I want to copy a file from the network drive to the local
drive.  The network drive is mapped to T:.  If I embed the code
COPY(T:\Company,'C:\TOWPRO~1\Company') I get error messages that it
doesn't like the : or the \ which are part of T:\.  How do reference the
file on the network drive T: so I can copy it to the local drive?

TIA

Gary



Mon, 18 Mar 2002 03:00:00 GMT  
 Copy file from network drive?
Gary

Quote:
> COPY(T:\Company,'C:\TOWPRO~1\Company')

Both parameters should be quoted strings

Copy('T:\Company', 'C:\TOWPRO~1\Company')

Note this enclosing single quotes.

Also, unless you are working in 16-bit, you should use the long file- and
pathnames

HTH

--
Steve Ingle
C S Data Systems
CW4 / CW5 / VB6 / VC++ / Win9x / NT / Linux ;-}




Tue, 19 Mar 2002 03:00:00 GMT  
 Copy file from network drive?
Hi Gary,

Quote:

> Using CW2003.  I want to copy a file from the network drive to the local
> drive.  The network drive is mapped to T:.  If I embed the code
> COPY(T:\Company,'C:\TOWPRO~1\Company') I get error messages that it
> doesn't like the : or the \ which are part of T:\.  How do reference the
> file on the network drive T: so I can copy it to the local drive?

> TIA

> Gary

In addition to Stephen's answer, if you use a variable source-file
name, you can use string manipulation here too.  Here's a bit of
cleverness I used in one of my recent programs.  I got the program's
starting path from a PATH() in the Main initialization, and:
COPY(GLO:ProgramPath & '\Orders.dbf', 'A:\Orderbak.dbf')

Mark Kroflich
mark(a)lists-inc.com



Tue, 19 Mar 2002 03:00:00 GMT  
 Copy file from network drive?
Hi Stephen

Here is what I tried so I could test it on my own machine.

COPY('G:COMPANY.TPS','G:\CW20\APPS\TOW\Company.TPS')

When I compile I get the error, "Must specify identifier" with the
cursor in between the ( and '.

Any ideas?

Gary

Quote:

> Gary

> > COPY(T:\Company,'C:\TOWPRO~1\Company')

> Both parameters should be quoted strings

> Copy('T:\Company', 'C:\TOWPRO~1\Company')

> Note this enclosing single quotes.

> Also, unless you are working in 16-bit, you should use the long file- and
> pathnames

> HTH

> --
> Steve Ingle
> C S Data Systems
> CW4 / CW5 / VB6 / VC++ / Win9x / NT / Linux ;-}





Fri, 22 Mar 2002 03:00:00 GMT  
 Copy file from network drive?
Hi Mark

I tried using a local variable to hold the path and used the code:

COPY(LOC:COMPANYPATH,'G:\CW20\APPS\TOW\Company.TPS')

When I compiled I got the error, "Parameter kind does not match."

Any ideas?

Gary

Quote:

> Hi Gary,


> > Using CW2003.  I want to copy a file from the network drive to the local
> > drive.  The network drive is mapped to T:.  If I embed the code
> > COPY(T:\Company,'C:\TOWPRO~1\Company') I get error messages that it
> > doesn't like the : or the \ which are part of T:\.  How do reference the
> > file on the network drive T: so I can copy it to the local drive?

> > TIA

> > Gary

> In addition to Stephen's answer, if you use a variable source-file
> name, you can use string manipulation here too.  Here's a bit of
> cleverness I used in one of my recent programs.  I got the program's
> starting path from a PATH() in the Main initialization, and:
> COPY(GLO:ProgramPath & '\Orders.dbf', 'A:\Orderbak.dbf')

> Mark Kroflich
> mark(a)lists-inc.com



Fri, 22 Mar 2002 03:00:00 GMT  
 Copy file from network drive?
Hi Gary,
CW5 WE.
I have a big program which copy a lot a data (more than 2 MB each) throught
a Microsoft Network and a Wide area network.
I have encountered your problem. I do not remember the way i solve the
problem.
But now i use API :
   i# =  CopyFileA(*LPCSTR,*LPCSTR,BOOL),BOOL,Pascal,RAW
Try to use it.

If you have problem using this API, post a mail in my personnal mail and i
will send you an example.
Do not forget to specify the version of clarion you are using.

Cdt,
RLC

--
Luc RAGUEL
Media Plus Consultant
Voie n0, Rue Thomas EDISON
Immeuble BARCA, S/C TRANSIT BIJOU,
Z.I de Jarry
97122 BAIE MAHAULT
Tel:05.90.38.34.96
Fax:05.90.38.34.97
Mobile:05.90.55.32.55




Quote:
> Using CW2003.  I want to copy a file from the network drive to the local
> drive.  The network drive is mapped to T:.  If I embed the code
> COPY(T:\Company,'C:\TOWPRO~1\Company') I get error messages that it
> doesn't like the : or the \ which are part of T:\.  How do reference the
> file on the network drive T: so I can copy it to the local drive?

> TIA

> Gary



Fri, 22 Mar 2002 03:00:00 GMT  
 Copy file from network drive?
Here is a piece of code I tossed together that copies files across a
network.

Example 1:  I wrote this to get around the problem of distributing the
latest version of a program to every desktop.  The problem arose
because you can't replace a running .exe file.  So, every desktop gets
a config file with a station id.  This id is unique to the network and
is used for tracking modifications to the databse.  By putting this
program on their desktop, it copies the current executable from the
location specified in the sever configuration file, freeing me from
the task of calling every dept and asking them to log out so I can
perform an update.  This runs on a 95/98 machine tied to NT server via
NetBIOS over TCP/IP.  Filenames in config file are UNC long names.  I
have not tried this with files that have spaces in their names, but it
should work just as well.

Example 2:  These code pieces are used to allow a database to run over
a slow dial-up link but keep decent response times by using a locally
cached copy of the data.  This has the added benefit of allowing the
program to run with sample data from a floppy disk, or to work
offline, just using the cached data.  Again, the workstations are
95/98 and the server is NT.  The clients connect via RAS and use
NETBEUI.

Hope these help.

William Grace

!*** Begin Example 1
                  PROGRAM

                  MAP
                  END

SourceName        STRING(260)
TargetName        STRING(260)
Count             ULONG

Stations
FILE,DRIVER('TOPSPEED'),NAME('\\Server\Data\Department\Stations.c29'),RECLAIM,OWNER('Company'),PRE(STA),ENCRYPT
ByID                  KEY(+STA:ID),OPT,NOCASE
ByDescription         KEY(+STA:Description),DUP,OPT,NOCASE
ByLocation            KEY(+STA:Location),DUP,OPT,NOCASE
ByFilename            KEY(+STA:Filename),DUP,OPT,NOCASE
RECORD                RECORD
ID                      ULONG
Description             STRING(255)
Location                STRING(255)
Filename                STRING(255)
                      END
                    END
Config
FILE,DRIVER('TOPSPEED'),NAME('C:\CONFIG.S29'),OWNER('Maribel'),PRE(CFG),ENCRYPT
RECORD                RECORD
ID                      ULONG
Description             STRING(20)
DrawerCode              BYTE
Message1                STRING(54)
Message2                STRING(54)
                      END
                    END

  CODE

  OPEN(Config)
  DO CheckError
  SET(Config)
  NEXT(Config)
  DO CheckError
  CLOSE(Config)
  DO CheckError
  SHARE(Stations)
  DO CheckError
  CLEAR(STA:RECORD)
  STA:ID = CFG:ID
  GET(Stations,STA:ByID)
  DO CheckError
  CLOSE(Stations)
  DO CheckError
  COPY(STA:Filename,'C:\~CLUB29.EXE')
  DO CheckError
  RUN('C:\~CLUB29.EXE')

CheckError        ROUTINE
  IF ERRORCODE() THEN
    HALT(1,'Error: '& ERROR())
  END
!*** End Example 1

!*** Begin Example 2

! Snippet 1
! This is from the first dialog box
! There are four modes, and they each setup with different filenames
DataMode = 1
LocalConfigFilename   = 'C:\CONFIG.GLF'
LocalSecurityFilename = 'C:\PASSWORD.GLF'
LocalMembersFilename  = 'C:\MEMBERS.GLF'
LocalPostingsFilename = 'C:\POSTINGS.GLF'
LocalToursFilename    = 'C:\TOURS.GLF'
RemoteConfigFilename   = '\\GOLF\C\DATA\CONFIG.GLF'
RemoteSecurityFilename = '\\GOLF\C\DATA\PASSWORD.GLF'
RemoteMembersFilename  = '\\GOLF\C\DATA\MEMBERS.GLF'
RemotePostingsFilename = '\\GOLF\C\DATA\POSTINGS.GLF'
RemoteToursFilename    = '\\GOLF\C\DATA\TOURS.GLF'
HIDE
Login
POST(EVENT:CloseWindow)

! Snippet 2
! The next dialog box is the username/password
! If correct name/pwd given, then files are cached
! by copying from Remote to Local machine.
! Be sure to inform users that this may take a while.
ProcTitle = '?OK.Accepted (Login)'
OPEN(RemoteSecurity)
CheckError
GET(RemoteSecurity,RSEC:ByUser)
CLOSE(RemoteSecurity)
IF ERRORCODE() AND ERRORCODE() <> 35
  STOP('?OK.Accepted (Login): '&ERRORFILE()&' - '&ERROR())
ELSIF ERRORCODE() = 35
  MESSAGE('User Not Found')
  CLEAR(RSEC:RECORD)
  CLEAR(Password)
  DISPLAY
  SELECT(?RSEC:UserName)
ELSIF RSEC:Password <> Password
  MESSAGE('Invalid Password')
  CLEAR(Password)
  DISPLAY
  SELECT(?Password)
ELSIF RSEC:RequiredVersion > '2.00.0915'
  MESSAGE('Incorrect Version. Please See Program Administrator')
  POST(EVENT:CloseWindow)
ELSE
  IF DataMode <> 2
    REMOVE(LocalConfig)
    IF ERRORCODE() <> 2 THEN CheckError.
    COPY(RemoteConfig,LocalConfigFilename)
    CheckError

    REMOVE(LocalSecurity)
    IF ERRORCODE() <> 2 THEN CheckError.
    COPY(RemoteSecurity,LocalSecurityFilename)
    CheckError

    REMOVE(LocalMembers)
    IF ERRORCODE() <> 2 THEN CheckError.
    COPY(RemoteMembers,LocalMembersFilename)
    CheckError

    REMOVE(LocalPostings)
    IF ERRORCODE() <> 2 THEN CheckError.
    COPY(RemotePostings,LocalPostingsFilename)
    CheckError

    REMOVE(LocalTours)
    IF ERRORCODE() <> 2 THEN CheckError.
    COPY(RemoteTours,LocalToursFilename)
    CheckError

  END
  HIDE
  Main
  POST(EVENT:CloseWindow)
END

!*** End Example 2

On Thu, 30 Sep 1999 17:38:31 +0100, Gary Stephens

Quote:

>Using CW2003.  I want to copy a file from the network drive to the local
>drive.  The network drive is mapped to T:.  If I embed the code
>COPY(T:\Company,'C:\TOWPRO~1\Company') I get error messages that it
>doesn't like the : or the \ which are part of T:\.  How do reference the
>file on the network drive T: so I can copy it to the local drive?

>TIA

>Gary



Sat, 23 Mar 2002 03:00:00 GMT  
 Copy file from network drive?
Hi Gary,

Now this error might be helpful... according to my help files,
"Parameter kind does not match" means "When passing parameters by
address, you must pass the same data type as prototyped in the MAP
structure."  In other words, COPY is expecting something other than
a string.  Try this, maybe:

COPY(MyCompanyFile, 'G:\CW20\APPS\TOW\Company.TPS')
Replace ^^^^^^ this with your company file, of course.  If it works,
COPY was probably expecting the file instead of its path.  If not,
it's time to look at the MAP for the file that defines COPY and
find out what it's expecting.  (As a side note, my Clarion 4 accepts
either (FILE, STRING) or (STRING, STRING).)

HTH
Mark Kroflich
mark(a)lists-inc.com

Quote:

> Hi Mark

> I tried using a local variable to hold the path and used the code:

> COPY(LOC:COMPANYPATH,'G:\CW20\APPS\TOW\Company.TPS')

> When I compiled I got the error, "Parameter kind does not match."

> Any ideas?

> Gary


> > Hi Gary,


> > > Using CW2003.  I want to copy a file from the network drive to the local
> > > drive.  The network drive is mapped to T:.  If I embed the code
> > > COPY(T:\Company,'C:\TOWPRO~1\Company') I get error messages that it
> > > doesn't like the : or the \ which are part of T:\.  How do reference the
> > > file on the network drive T: so I can copy it to the local drive?

> > > TIA

> > > Gary

> > In addition to Stephen's answer, if you use a variable source-file
> > name, you can use string manipulation here too.  Here's a bit of
> > cleverness I used in one of my recent programs.  I got the program's
> > starting path from a PATH() in the Main initialization, and:
> > COPY(GLO:ProgramPath & '\Orders.dbf', 'A:\Orderbak.dbf')

> > Mark Kroflich
> > mark(a)lists-inc.com



Sat, 23 Mar 2002 03:00:00 GMT  
 Copy file from network drive?
Hi Mark

I already use that to copy a file to the network drive and it works
fine.  Dug it out of the Help.  My problem is I want to copy a file from
the network drive back to the local drive so I need to specify a path
and that is where Copy fails.  It appears it won't accept anything other
than a filename as the first parameter.

Gary

Quote:

> Hi Gary,

> Now this error might be helpful... according to my help files,
> "Parameter kind does not match" means "When passing parameters by
> address, you must pass the same data type as prototyped in the MAP
> structure."  In other words, COPY is expecting something other than
> a string.  Try this, maybe:

> COPY(MyCompanyFile, 'G:\CW20\APPS\TOW\Company.TPS')
> Replace ^^^^^^ this with your company file, of course.  If it works,
> COPY was probably expecting the file instead of its path.  If not,
> it's time to look at the MAP for the file that defines COPY and
> find out what it's expecting.  (As a side note, my Clarion 4 accepts
> either (FILE, STRING) or (STRING, STRING).)

> HTH
> Mark Kroflich
> mark(a)lists-inc.com


> > Hi Mark

> > I tried using a local variable to hold the path and used the code:

> > COPY(LOC:COMPANYPATH,'G:\CW20\APPS\TOW\Company.TPS')

> > When I compiled I got the error, "Parameter kind does not match."

> > Any ideas?

> > Gary


> > > Hi Gary,


> > > > Using CW2003.  I want to copy a file from the network drive to the local
> > > > drive.  The network drive is mapped to T:.  If I embed the code
> > > > COPY(T:\Company,'C:\TOWPRO~1\Company') I get error messages that it
> > > > doesn't like the : or the \ which are part of T:\.  How do reference the
> > > > file on the network drive T: so I can copy it to the local drive?

> > > > TIA

> > > > Gary

> > > In addition to Stephen's answer, if you use a variable source-file
> > > name, you can use string manipulation here too.  Here's a bit of
> > > cleverness I used in one of my recent programs.  I got the program's
> > > starting path from a PATH() in the Main initialization, and:
> > > COPY(GLO:ProgramPath & '\Orders.dbf', 'A:\Orderbak.dbf')

> > > Mark Kroflich
> > > mark(a)lists-inc.com



Sat, 23 Mar 2002 03:00:00 GMT  
 Copy file from network drive?
Hi William

It appears that your second example is similar to what I'm trying to
do.  I have a mapped network drive & folder to T: where my program and
data files reside.  I want to copy a file Company.TPS from my mapped
drive T: back to the local drive C: from a program running on the local
drive C:.  The problem I'm encountering is that COPY does not seem to
accept anything other than a filename as the first parameter. Without
the path COPY does not know where to find the file I'm trying to copy.
So how do I construct a COPY statement that the compiler will accept and
COPY will be able to find the file on the network drive?

It is probably obvious that I am a neophyte when it comes to networks.
I could copy the file from the network drive from the program on the
network if I knew how to tell it which remote machine to copy it to.  Is
there a way to do this?

TIA

Gary

I tried



Sat, 23 Mar 2002 03:00:00 GMT  
 Copy file from network drive?
Hi Gary,

Quote:
>Using CW2003.
>COPY(T:\Company,'C:\TOWPRO~1\Company')

The copy-command in CW2 only accepts the label of a filestructure
as it's first parameter. When the file you want to copy is a known
file from your application then: COPY(MyFile,'C:\TOWPRO~1')
would do the trick. MyFile is the label of the file to copy. If the filename
of this file is: Company.Tps then a copy of this file will be created
under the C:\TOWPRO~1 directory. Of course make sure that T:\
is your default path or that the complete path is given in the name-
attribute of MyFile otherwise you'll get a 'File not found'-error.

If you want to copy a(ny) file that is _not_ in your dictionary then
create a "dummy" file with a (global) variable as it's filename.
Then, before the copy, enter the full filespec (Drive:\Path\Filename
_and_ extension) into the global variable, e.g.:
GLO:FileSpec = 'T:\test\Company.Txt' and then use the copy-
command: COPY(CopyFile,'C:\TOWPRO~1')
where 'CopyFile' is the label of the "dummy" file.
At best you choose 'Dos', 'Basic' or 'Ascii' as the file-driver
for this dummy-file so the copy-command does not interfere
with the filespec such as assuming a default extension or
internal tables (.Tps).

--
Best regards,
Maarten



Sun, 24 Mar 2002 03:00:00 GMT  
 Copy file from network drive?
Thanks

I'll give this a try.

Gary

Quote:

> Hi Gary,

> >Using CW2003.
> >COPY(T:\Company,'C:\TOWPRO~1\Company')
> The copy-command in CW2 only accepts the label of a filestructure
> as it's first parameter. When the file you want to copy is a known
> file from your application then: COPY(MyFile,'C:\TOWPRO~1')
> would do the trick. MyFile is the label of the file to copy. If the filename
> of this file is: Company.Tps then a copy of this file will be created
> under the C:\TOWPRO~1 directory. Of course make sure that T:\
> is your default path or that the complete path is given in the name-
> attribute of MyFile otherwise you'll get a 'File not found'-error.

> If you want to copy a(ny) file that is _not_ in your dictionary then
> create a "dummy" file with a (global) variable as it's filename.
> Then, before the copy, enter the full filespec (Drive:\Path\Filename
> _and_ extension) into the global variable, e.g.:
> GLO:FileSpec = 'T:\test\Company.Txt' and then use the copy-
> command: COPY(CopyFile,'C:\TOWPRO~1')
> where 'CopyFile' is the label of the "dummy" file.
> At best you choose 'Dos', 'Basic' or 'Ascii' as the file-driver
> for this dummy-file so the copy-command does not interfere
> with the filespec such as assuming a default extension or
> internal tables (.Tps).

> --
> Best regards,
> Maarten



Sun, 24 Mar 2002 03:00:00 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. Copy file from network drive to local drive?

2. WIN API to copy all files form A: drive to C:\FOLDER

3. WIN API to copy file from A: drive to C:\Folder

4. Copy files from floppy drives

5. Copying Files to another drive

6. Opening files on a network drive.

7. PHP files don't work in Windows network drive

8. Accessing a file in a network drive (python under win32)

9. CANNOT COPY VI FILE OVER NETWORK using win XP

10. CW2.003 File copy changes the date.....need a way to copy w/o date change

11. BUG: file copy copies links as links

12. Can't connect to library across mapped network drive

 

 
Powered by phpBB® Forum Software