Page 1 of 1

Old topic about xcopy

Posted: 24 Jul 2020 18:56
by goodywp
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

Re: Old topic about xcopy

Posted: 24 Jul 2020 19:17
by Squashman
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.

Re: Old topic about xcopy

Posted: 25 Jul 2020 06:06
by goodywp
@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 - *

Re: Old topic about xcopy

Posted: 25 Jul 2020 11:35
by aGerman
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

Re: Old topic about xcopy

Posted: 27 Jul 2020 04:34
by bakemonogatari
try:

dir %source%

and see if there is an error...

Re: Old topic about xcopy

Posted: 04 Aug 2020 12:27
by goodywp
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

Re: Old topic about xcopy

Posted: 04 Aug 2020 15:23
by goodywp
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...

Re: Old topic about xcopy

Posted: 04 Aug 2020 16:00
by goodywp
@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...
:(

Re: Old topic about xcopy

Posted: 05 Aug 2020 10:31
by aGerman
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