Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - copy-item changing files attributes on network copy failures

Reply
 
Old 01-30-2008   #1 (permalink)
jas


 
 

copy-item changing files attributes on network copy failures

I came across very strange behaviour in copy-item today. When copying a
read-only file repeatedly from the network to a local folder the first copy
works but the second copy fails, however the third copy works. The exact
same copy-item test using local C: paths works fine. Has anyone else seen
this behaviour before?

The example below shows the attribute change after the failed copy.

PS>gci \\myserver\share\testfile.exe

Directory:
Microsoft.PowerShell.Core\FileSystem::\\myserver\share\testfile.exe

Mode LastWriteTime Length Name
---- ------------- ------ ----
-ar-- 17/01/2008 07:45 270336 testfile.exe

PS>1..10 | %{copy-item "\\myserver\share\testfile.exe" . -force ; gci}
Directory: Microsoft.PowerShell.Core\FileSystem::C:\Documents and
Settings\jas

Mode LastWriteTime Length Name
---- ------------- ------ ----
-ar-- 17/01/2008 07:45 270336 testfile.exe
Copy-Item : The file 'C:\DOCUME~1\jas\testfile.exe' already exists.
At line:1 char:20
+ 1..10 | %{copy-item <<<< "\\myserver\share\testfile.exe" . -force ; gci}
-a--- 17/01/2008 07:45 270336 testfile.exe
-ar-- 17/01/2008 07:45 270336 testfile.exe
Copy-Item : The file 'C:\DOCUME~1\jas\testfile.exe' already exists.
At line:1 char:20
+ 1..10 | %{copy-item <<<< "\\myserver\share\testfile.exe" . -force ; gci}
-a--- 17/01/2008 07:45 270336 testfile.exe
-ar-- 17/01/2008 07:45 270336 testfile.exe
Copy-Item : The file 'C:\DOCUME~1\jas\testfile.exe' already exists.
At line:1 char:20
+ 1..10 | %{copy-item <<<< "\\myserver\share\testfile.exe" . -force ; gci}
-a--- 17/01/2008 07:45 270336 testfile.exe
-ar-- 17/01/2008 07:45 270336 testfile.exe
Copy-Item : The file 'C:\DOCUME~1\jas\testfile.exe' already exists.
At line:1 char:20
+ 1..10 | %{copy-item <<<< "\\myserver\share\testfile.exe" . -force ; gci}
-a--- 17/01/2008 07:45 270336 testfile.exe
-ar-- 17/01/2008 07:45 270336 testfile.exe
Copy-Item : The file 'C:\DOCUME~1\jas\testfile.exe' already exists.
At line:1 char:20
+ 1..10 | %{copy-item <<<< "\\myserver\share\testfile.exe" . -force ; gci}
-a--- 17/01/2008 07:45 270336 testfile.exe


My System SpecsSystem Spec
Old 01-30-2008   #2 (permalink)
Marco Shaw [MVP]


 
 

Re: copy-item changing files attributes on network copy failures

jas wrote:
Quote:

> I came across very strange behaviour in copy-item today. When copying a
> read-only file repeatedly from the network to a local folder the first
> copy works but the second copy fails, however the third copy works. The
> exact same copy-item test using local C: paths works fine. Has anyone
> else seen this behaviour before?
I'll try it out tomorrow. Just for fun, I'll also put in a start-sleep
-seconds XX on each run if I see the same failures.

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 01-31-2008   #3 (permalink)
Marco Shaw [MVP]


 
 

Re: copy-item changing files attributes on network copy failures

jas wrote:
Quote:

> I came across very strange behaviour in copy-item today. When copying a
> read-only file repeatedly from the network to a local folder the first
> copy works but the second copy fails, however the third copy works. The
> exact same copy-item test using local C: paths works fine. Has anyone
> else seen this behaviour before?

I tested this with the v2 CTP, and could not reproduce. I'm sorry, but
I can't try v1 right now, but perhaps someone else can help out.

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 01-31-2008   #4 (permalink)
jas


 
 

Re: copy-item changing files attributes on network copy failures

Thak you for looking, I have the opisite problem and cannot test with the
CTP version.

"Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
news:u1Q6JDBZIHA.4828@xxxxxx
Quote:

> jas wrote:
Quote:

>> I came across very strange behaviour in copy-item today. When copying a
>> read-only file repeatedly from the network to a local folder the first
>> copy works but the second copy fails, however the third copy works. The
>> exact same copy-item test using local C: paths works fine. Has anyone
>> else seen this behaviour before?
>
>
> I tested this with the v2 CTP, and could not reproduce. I'm sorry, but I
> can't try v1 right now, but perhaps someone else can help out.
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 01-31-2008   #5 (permalink)
Marco Shaw [MVP]


 
 

Re: copy-item changing files attributes on network copy failures

jas wrote:
Quote:

> Thak you for looking, I have the opisite problem and cannot test with
> the CTP version.
I have an idea though, and will try it with v1 within the next few days.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
bug in copy-item of readonly files PowerShell
Can the copy-item cmdlet be used to copy public folders to C: ? PowerShell
Getting Copy-Item to display messages (like the old COPY command in CMD.EXE) ?? PowerShell
copy files with AD attributes in name?? PowerShell
Copy-Item or Copy-ItemProperty and Remote Registry. PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46