PC Review


Reply
Thread Tools Rate Thread

Copy question

 
 
Mike Hood
Guest
Posts: n/a
 
      21st Oct 2005
This seems really simple, but I can't readily find the answer on the Web...
I'm trying to copy files from ServerA to ServerB in a batchfile. I can't get
it to work with

copy \\ServerA\c$\file.fil \\ServerB\d$

but instead it seems that I need to map drives to the servers as appropriate
and then use their letters, eg

copy u:\file.fil v:\

Is this right?

Thanks!


 
Reply With Quote
 
 
 
 
Jerold Schulman
Guest
Posts: n/a
 
      21st Oct 2005
On Fri, 21 Oct 2005 10:16:37 +0100, "Mike Hood" <(E-Mail Removed)> wrote:

>This seems really simple, but I can't readily find the answer on the Web...
>I'm trying to copy files from ServerA to ServerB in a batchfile. I can't get
>it to work with
>
>copy \\ServerA\c$\file.fil \\ServerB\d$
>
>but instead it seems that I need to map drives to the servers as appropriate
>and then use their letters, eg
>
>copy u:\file.fil v:\
>
>Is this right?
>
>Thanks!
>


No.

copy \\ServerA\c$\file.fil \\ServerB\d$\*.*

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 
Reply With Quote
 
 
 
 
Mark V
Guest
Posts: n/a
 
      21st Oct 2005
In microsoft.public.win2000.cmdprompt.admin Mike Hood wrote:

> This seems really simple, but I can't readily find the answer on
> the Web... I'm trying to copy files from ServerA to ServerB in a
> batchfile. I can't get it to work with
>
> copy \\ServerA\c$\file.fil \\ServerB\d$
>
> but instead it seems that I need to map drives to the servers as
> appropriate and then use their letters, eg
>
> copy u:\file.fil v:\


Aside from syntax, is this batch running under an account (Scheduled
perhaps) that has no network access? The error msg is _ ?
 
Reply With Quote
 
Mike Hood
Guest
Posts: n/a
 
      25th Oct 2005
Rewrote the batchfile and it's now working as I'd originally intended. I
don't know what I'd done last week - must be a typo I'd misssed, despite
checking. Sorry to have wasted your time!

BTW, it was under a full admin account with network access. Msg was "The
network path was not found."

Thanks anyway.

"Mark V" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In microsoft.public.win2000.cmdprompt.admin Mike Hood wrote:
>
>> This seems really simple, but I can't readily find the answer on
>> the Web... I'm trying to copy files from ServerA to ServerB in a
>> batchfile. I can't get it to work with
>>
>> copy \\ServerA\c$\file.fil \\ServerB\d$
>>
>> but instead it seems that I need to map drives to the servers as
>> appropriate and then use their letters, eg
>>
>> copy u:\file.fil v:\

>
> Aside from syntax, is this batch running under an account (Scheduled
> perhaps) that has no network access? The error msg is _ ?



 
Reply With Quote
 
Mike Hood
Guest
Posts: n/a
 
      25th Oct 2005
Problem solved now (see earlier reply) - but, I beg to differ over the need
for the "\*.*" at the end.

"Jerold Schulman" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Fri, 21 Oct 2005 10:16:37 +0100, "Mike Hood"
> <(E-Mail Removed)> wrote:
>
>>This seems really simple, but I can't readily find the answer on the
>>Web...
>>I'm trying to copy files from ServerA to ServerB in a batchfile. I can't
>>get
>>it to work with
>>
>>copy \\ServerA\c$\file.fil \\ServerB\d$
>>
>>but instead it seems that I need to map drives to the servers as
>>appropriate
>>and then use their letters, eg
>>
>>copy u:\file.fil v:\
>>
>>Is this right?
>>
>>Thanks!
>>

>
> No.
>
> copy \\ServerA\c$\file.fil \\ServerB\d$\*.*
>
> Jerold Schulman
> Windows Server MVP
> JSI, Inc.
> http://www.jsiinc.com
> http://www.jsifaq.com



 
Reply With Quote
 
William Allen
Guest
Posts: n/a
 
      25th Oct 2005
"Mike Hood" wrote in message
> Problem solved now (see earlier reply) - but, I beg to differ over the need
> for the "\*.*" at the end.


You would be unwise to omit the trailing \*.* from the destination
filespec in COPY-ing. If you make a habit of this omission, and the
destination folder happens not to exist (say, because of a typo in
its name), all the files specified in the source wildcard may be
concatenated in ASCII COPY mode to a single destination file
(assigned with the folder name as filename). This is unlikely to
be helpful, nor what you intend, and the single destination file
contents may be unrecoverable as separate files.

Merely to save a few characters in the command line, the
resulting command ambiguity may become a nasty problem
waiting to happen when you least expect or want it.

--
William Allen
Free interactive Batch Course http://www.allenware.com/icsw/icswidx.htm
Batch Reference with examples http://www.allenware.com/icsw/icswref.htm
From email address not checked. Contact us at http://www.allenware.com/


 
Reply With Quote
 
foxidrive
Guest
Posts: n/a
 
      25th Oct 2005
On Tue, 25 Oct 2005 13:08:25 +0100, William Allen wrote:

> "Mike Hood" wrote in message
>> Problem solved now (see earlier reply) - but, I beg to differ over the need
>> for the "\*.*" at the end.

>
> You would be unwise to omit the trailing \*.* from the destination


You only need the trailing backslash. the *.* is superfluous.

> filespec in COPY-ing. If you make a habit of this omission, and the
> destination folder happens not to exist (say, because of a typo in
> its name), all the files specified in the source wildcard may be
> concatenated in ASCII COPY mode to a single destination file
> (assigned with the folder name as filename). This is unlikely to
> be helpful, nor what you intend, and the single destination file
> contents may be unrecoverable as separate files.
>
> Merely to save a few characters in the command line, the
> resulting command ambiguity may become a nasty problem
> waiting to happen when you least expect or want it.

 
Reply With Quote
 
William Allen
Guest
Posts: n/a
 
      25th Oct 2005
"foxidrive" wrote in message
> On Tue, 25 Oct 2005 13:08:25 +0100, William Allen wrote:
>
> > "Mike Hood" wrote in message
> >> Problem solved now (see earlier reply) - but, I beg to differ over the need
> >> for the "\*.*" at the end.

> >
> > You would be unwise to omit the trailing \*.* from the destination

>
> You only need the trailing backslash. the *.* is superfluous.

....snip

Without the \*.* the syntax may fail in Windows 95/98/ME. With the
proper syntax, the command line is portable. Further, it's unwise to
save a few characters and leave the command syntax less clear.

--
William Allen
Free interactive Batch Course http://www.allenware.com/icsw/icswidx.htm
Batch Reference with examples http://www.allenware.com/icsw/icswref.htm
From email address not checked. Contact us at http://www.allenware.com/


 
Reply With Quote
 
foxidrive
Guest
Posts: n/a
 
      25th Oct 2005
On Tue, 25 Oct 2005 17:52:53 +0100, William Allen wrote:

> "foxidrive" wrote in message
>> On Tue, 25 Oct 2005 13:08:25 +0100, William Allen wrote:
>>
>>> "Mike Hood" wrote in message
>>>> Problem solved now (see earlier reply) - but, I beg to differ over the need
>>>> for the "\*.*" at the end.
>>>
>>> You would be unwise to omit the trailing \*.* from the destination

>>
>> You only need the trailing backslash. the *.* is superfluous.

> ...snip
>
> Without the \*.* the syntax may fail in Windows 95/98/ME.


Explain how. Why isn't it good enough to indicate to the file system that
it is a folder being copied into? Take into consideration the explanation
you gave before and snipped out.
 
Reply With Quote
 
Al Dunbar
Guest
Posts: n/a
 
      29th Oct 2005

"William Allen" <_wa_@email.com> wrote in message
news:435e62ff$0$15042$(E-Mail Removed)...
> "foxidrive" wrote in message
>> On Tue, 25 Oct 2005 13:08:25 +0100, William Allen wrote:
>>
>> > "Mike Hood" wrote in message
>> >> Problem solved now (see earlier reply) - but, I beg to differ over the
>> >> need
>> >> for the "\*.*" at the end.
>> >
>> > You would be unwise to omit the trailing \*.* from the destination

>>
>> You only need the trailing backslash. the *.* is superfluous.

> ...snip
>
> Without the \*.* the syntax may fail in Windows 95/98/ME. With the
> proper syntax, the command line is portable. Further, it's unwise to
> save a few characters and leave the command syntax less clear.


I generally agree, however it is a rare batch file that I write these days
that will or can run on any 9X variant. One reason is that we have weaned
ourselves from 9x, and the other is that most of my scripts make use of
batch functionality that only became available in w2k. But to be sure, I
always use the .cmd extension.

Further, I find the "directoryname\" syntax to be a less ambiguous reference
to the fact that this is a directory. Having to include a file specification
like *.* makes it seem that a directory needs to have files before it really
is a directory.

/Al



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy local users and groups, copy shares with security, copy homeuser folders usenet@sphere10.com Microsoft Windows 2000 Active Directory 1 17th Feb 2009 02:31 PM
Copy local users and groups, copy shares with security, copy homeuser folders usenet@sphere10.com Windows Vista General Discussion 2 17th Feb 2009 02:31 PM
Perhaps and off topic question....but could use some help with video question.....I don't need codec help, just a general question. Bret Miller DIY PC 0 13th Oct 2006 12:23 AM
EXCEL FILE a copy/a copy/a copy ....filename =?Utf-8?B?dmU=?= Microsoft Excel New Users 1 29th Sep 2005 09:12 PM
Ghost copy or image copy of my drive question Aslaner Windows XP Help 3 13th Oct 2004 01:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:33 AM.