Old topic about xcopy

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
goodywp
Posts: 265
Joined: 31 Jul 2017 09:57

Old topic about xcopy

#1 Post by goodywp » 24 Jul 2020 18:56

Hi all,

I had a xcopy issue as below:

Code: Select all

xcopy "source\folder\*" "destination\%folder%" /s /i
Since the source is located in network drive and mapped to Y:

I had two tries, one on my PC, another on server

on PC,
When used Y:\xxxx\folder , the above is working, but if using \\casnprfil1\xxxx\folder got an error as File not found - *

However, on Server, other than casnprfil1, also mapped to Y
When used Y:\xxxx\folder , got Invalid drive specification, but if using \\casnprfil1\xxxx\folder got an error as File not found - *

Anyone had such experience, what is wrong here?

Thanks

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Old topic about xcopy

#2 Post by Squashman » 24 Jul 2020 19:17

You don't seem to showing us the correct information.

Drive letters are normally mapped to at least a server share.

So if my server share was \\casnprfil1\xxxx with a folder named folder like you are showing, the the drive mapping would look like Y:\folder

Regardless you also have a variable within your code but have refused to show if that variable is defined.

Your explanation is too obfuscated and I have no idea how your servers shares are really mapped.

Would help to see the real world output of the NET USE command from all the computers you are trying to do this from.

goodywp
Posts: 265
Joined: 31 Jul 2017 09:57

Re: Old topic about xcopy

#3 Post by goodywp » 25 Jul 2020 06:06

@Squashman! Thanks for your reply. Here is the real one

Code: Select all

set source=\\casnprfil1\QADATA\QA_RELEASE\T500B09046-0200_Lane7000_TWM_MOCKUP_00000
set destination=D:\CA_CONVERT\New_pkg
set opkg=T500B09046-0200_Lane7000_TWM_MOCKUP_00000
xcopy "%source%\*" "%destination%\%opkg%" /s /i
on PC,
set source=Y:\QADATA\QA_RELEASE\T500B09046-0200_Lane7000_TWM_MOCKUP_00000
the above is working,
but if
set source=\\casnprfil1\QADATA\QA_RELEASE\T500B09046-0200_Lane7000_TWM_MOCKUP_00000
got an error as File not found - *

However, on Server, other than casnprfil1, also mapped to Y
set source=Y:\QADATA\QA_RELEASE\T500B09046-0200_Lane7000_TWM_MOCKUP_00000
got Invalid drive specification,

but if
set source=\\casnprfil1\QADATA\QA_RELEASE\T500B09046-0200_Lane7000_TWM_MOCKUP_00000
got an error as File not found - *

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Old topic about xcopy

#4 Post by aGerman » 25 Jul 2020 11:35

As far as I recall xcopy doesn't support UNC paths. So, either map it to a drive using NET USE or just change the current directory using PUSHD/POPD.
To avoid this pain use ROBOCOPY rather than XCOPY.

Steffen

bakemonogatari
Posts: 21
Joined: 08 Jul 2019 05:22

Re: Old topic about xcopy

#5 Post by bakemonogatari » 27 Jul 2020 04:34

try:

dir %source%

and see if there is an error...

goodywp
Posts: 265
Joined: 31 Jul 2017 09:57

Re: Old topic about xcopy

#6 Post by goodywp » 04 Aug 2020 12:27

Thanks both bakemonogatari and aGerman!!

The issue was about the mapping for the path, usually there is a root folder which will be mapped in Y: (that is Y:=\\casnprfil1\rootfolder).
After corrected this issue, both working fine.

However, there is another issue came out on the surface luckily caught...

by many experimental running these two paths (one is mapped the other is using server name)
Using mapped path is more safer than this server name one, that is

Code: Select all

set source=Y:\QADATA\QA_RELEASE\T500B09046-0200_Lane7000_TWM_MOCKUP_00000
::set source=\\casnprfil1\Secondary\QADATA\QA_RELEASE\T500B09046-0200_Lane7000_TWM_MOCKUP_00000
set destination=D:\CA_CONVERT\New_pkg
set opkg=T500B09046-0200_Lane7000_TWM_MOCKUP_00000
xcopy "%source%\*" "%destination%\%opkg%" /s /i
if set source=Y:\QADATA\QA_RELEASE\T500B09046-0200_Lane7000_TWM_MOCKUP_00000
run the above script it copy all the files

if set source=\\casnprfil1\Secondary\QADATA\QA_RELEASE\T500B09046-0200_Lane7000_TWM_MOCKUP_00000
run the above script it might lack of some files not copied...
really not know why had such difference and just observed the difference..
Thanks

goodywp
Posts: 265
Joined: 31 Jul 2017 09:57

Re: Old topic about xcopy

#7 Post by goodywp » 04 Aug 2020 15:23

It is really dilemma.
The script itself run is OK. when it implemented on Bamboo server it is a dilemma..
when using mapped drive Y:/Mainfolder, it will complain Invalid drive specification
when using \\casnprfil1\root\Mainfolder, some files shall be missing not copied...

goodywp
Posts: 265
Joined: 31 Jul 2017 09:57

Re: Old topic about xcopy

#8 Post by goodywp » 04 Aug 2020 16:00

@aGerman yes you are right.

Code: Select all

set source=\\casnprfil1\QADATA\QA_RELEASE\T500B09046-0200_Lane7000_TWM_MOCKUP_00000
set destination=D:\CA_CONVERT\New_pkg
set opkg=T500B09046-0200_Lane7000_TWM_MOCKUP_00000
Robocopy /MIR "%source%" "%destination%\%opkg%" /E
the above works but still complaining and gave me red failed warn without any detailed info in bamboo plan...
:(

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Old topic about xcopy

#9 Post by aGerman » 05 Aug 2020 10:31

goodywp wrote:
04 Aug 2020 16:00
/MIR
Are you aware that this is for mirroring?
goodywp wrote:
04 Aug 2020 16:00
the above works but still complaining and gave me red failed warn without any detailed info in bamboo plan...
:(
Robocopy has several levels of "failing" where some of them don't even mean there was an error. So, you should have quoted the summary in the footer of the message you got, along with the errorlevel (which is a bitset in case of robocopy, and tells you alot about what really happend).

Steffen

Post Reply