header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Low performance with NTFS
Last Post 03 Dec 2008 03:33 PM by gato.mestre. 5 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
gato.mestreUser is Offline
New Member
New Member
Posts:2
Avatar

--
13 Nov 2008 04:38 AM  

Hi!

It´s my first post and I begin with a dummie issue! :)

I'm using powershell to copy/move files.

Every minute I received files on SOURCE folder. I have to complete two goals: copy source files to destination1 and move source files to destination2.

This is my code:


$listoffiles = Get-ChildItem d:\source\*.*
copy-Item -Path $listoffiles -destination d:\destination1\
move-Item -Path $listoffiles -destination d:\destination2\ -force

Questions:
 - Is it the best pratice?
 - Is it the best way?

I saw that sometimes the performance of move is low (when I'm with more than 2k files in source folder). I'm worry about the $listoffiles character limit.

Thank's, hugs for all and sorry by bad english!

Rafael França
Brazil

marco.shawUser is Offline
Co-Community Director
Basic Member
Basic Member
Posts:188
Avatar

--
02 Dec 2008 01:51 PM  
This would be an interesting test possibly... Instead of what you're doing above, trying something like this instead:

$listoffiles=gci d:\source\*.*
foreach($file in $listoffiles){
copy-item $file d:\destination1\
move-item $file d:\destination2\ -force
}

Perhaps you could compare the performance of this also.
Marco

*Microsoft MVP - Windows PowerShell: http://www.microsoft.com/mvp
*PowerGadgets MVP: http://www.powergadgets.com/mvp
*Blog: http://marcoshaw.blogspot.com
DanBallUser is Offline
New Member
New Member
Posts:26
Avatar

--
02 Dec 2008 10:06 PM  

Just out of curiousity, what is the benefit of using the copy-item command instead of just using the copy command?  

halr9000User is Offline
PowerShell MVP, Site Admin
Basic Member
Basic Member
Posts:334
Avatar

--
03 Dec 2008 01:23 AM  
Dan, in PowerShell, copy is an alias to Copy-Item, so they are the same.

And gato, don't forget you can wrap anything inside of measure-command { commands go here } to get it timed accurately.
Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast
Author, TechProsaic
glnsizeUser is Offline
Basic Member
Basic Member
Posts:101

--
03 Dec 2008 01:28 AM  
When moving files within the same tree move is tremendously faster as it just changes the index. If your moving between different file tree's i.e. partitions the actual blocks must be read and written. Also consider that copy will retain any NTFS permissions. Move/cut will relocate the file and inherit permissions from the parent folder. All of these can and DO impact performance... If your moving large amounts of data robocopy is still the preferred method. ~glenn
gato.mestreUser is Offline
New Member
New Member
Posts:2
Avatar

--
03 Dec 2008 03:33 PM  
Thanks for all! I made some performance tests and using pipe I use objects instead variable.
See how it works:

Get-Item D:\source\*.* |Move-Item -destination D:\destination1 -Force -PassThru |Copy-Item -Destination D:\destination2 -Force


If your moving large amounts of data robocopy is still the preferred method

glnsize, I cannot use robocopy because files are coming every time at source. I cannot lost a file moving without copy.
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer