powershell - Error "copy-item : The operation completed successfully" but it worked? -


i trying run following step in powershell, proceeds error out. file getting copied, i'm tempted workaround force , erroraction silentlycontinue. why happening? happens regardless of force flag, , regardless of file existing in target location.

note locations unc paths. added parts maybe make difference(?).

$rootpath = "\\servera\sharea" $stagedir = "$rootpath\submit"  #sample file $flagfl:  #-rw-rw-r-- 1 mname data 588573 aug 31 14:51 file16083101.000.z  $newfiles = get-content $rootpath\$flagfl |  foreach {$_.split(" ")[8]}  foreach ($thisfile in $newfiles) { $thisfile_unc=($thisfile).replace('.z','') $reccnt = (get-content $rootpath\$thisfile_unc | measure-object -line).lines $orionfile = "$thisfile_unc.$reccnt"  get-content $rootpath\$thisfile_unc |% {$_.replace("`n", "`r`n")} | out-file -encoding ascii -filepath $rootpath\$orionfile -force  copy-item $rootpath\$orionfile $stagedir -force  } 

error message:

copy-item : operation completed successfully. @ line:1 char:1 + copy-item $rootpath\$orionfile $stagedir -force + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + categoryinfo          : notspecified: (:) [copy-item], ioexception     + fullyqualifiederrorid : system.io.ioexception,microsoft.powershell.commands.copyitemcommand 

full error message requested () :

exception             : system.io.ioexception: operation completed successfully.                             @ system.io.__error.winioerror(int32 errorcode, string maybefullpath)                            @ system.io.file.internalcopy(string sourcefilename, string destfilename, boolean                          overwrite, boolean checkhost)                            @ system.io.fileinfo.copyto(string destfilename, boolean overwrite)                            @ microsoft.powershell.commands.filesystemprovider.copyfileinfoitem(fileinfo file, string                          destinationpath, boolean force)                            @ microsoft.powershell.commands.filesystemprovider.copyitem(string path, string                          destinationpath, boolean recurse)                            @ system.management.automation.sessionstateinternal.copyitem(cmdletprovider                          providerinstance, string path, string copypath, boolean recurse, cmdletprovidercontext context) targetobject          :  categoryinfo          : notspecified: (:) [copy-item], ioexception fullyqualifiederrorid : system.io.ioexception,microsoft.powershell.commands.copyitemcommand errordetails          :  invocationinfo        : system.management.automation.invocationinfo scriptstacktrace      : @ <scriptblock>, <no file>: line 1 pipelineiterationinfo : {} psmessagedetails      :  


Comments