How to check copy files end time

Author Message
Keiishi

  • Total Posts : 6
  • Scores: 0
  • Reward points : 0
  • Joined: 2/2/2011
  • Status: offline
How to check copy files end time Wednesday, June 08, 2011 10:19 PM (permalink)
0
Hi
Question as in subject. I have simple script in ps1 for copying some files.
I would like to see how many time it would take to end copying.

If anyone know how to do it. It will be great help.
If possible please write code in ease way, I dont have many experienc with ps1

Script below
 
$disc = Get-WmiObject Win32_LogicalDisk -filter "deviceID = 'e:' "
$freespace = $disc.FreeSpace
$user = $env:username #przechowuje zmienną %username%
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") 

{Copy-Item -path c:\aaa -Destination e:\bbb -recurse -Force}
{[System.Windows.Forms.MessageBox]::Show("backup end.")}

Best regards and thanks
Keiishi
 
#1
    TomRiddle

    • Total Posts : 620
    • Scores: 12
    • Reward points : 0
    • Joined: 2/7/2008
    • Location: Australia
    • Status: offline
    Re:How to check copy files end time Wednesday, June 08, 2011 11:44 PM (permalink)
    0
    [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | out-null;
    Measure-Command {Copy-Item -path c:\aaa -Destination e:\bbb -recurse -Force};
    [System.Windows.Forms.MessageBox]::Show("backup end.")
    -join([int[]][char[]]'Ut|jwXmjqq%Wzqjx'|%{[char]($_-5)})
     
    #2
      Keiishi

      • Total Posts : 6
      • Scores: 0
      • Reward points : 0
      • Joined: 2/2/2011
      • Status: offline
      Re:How to check copy files end time Thursday, June 09, 2011 3:14 AM (permalink)
      0
      Hi
      Tom thx for reply, that wasnt what I searched, but it was helpfull.
      I searched the web and finded some way to implement progress bar, but unfortunately it dont show any progress...
      Please help and tell me where I made mistake.

      Script below
       
      $disc = Get-WmiObject Win32_LogicalDisk -filter "deviceID = 'e:' "
      $freespace = $disc.FreeSpace
      $user = $env:username
      $path = "c:\aaa"
      $dest = "e:\aaa"
      $counter = 0
      $files = Get-ChildItem $path -recurse
      $file = Get-ChildItem $path -recurse -Name
      $copy = Copy-Item  $path $dest -recurse -Force
      $status = "Copying file {0} of {1}: {2}" -f $counter,$files.Count,$file.Name

      [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | out-null;

      {Foreach($file in $files)
      {Write-Progress -Activity "Copy Data" $status -PercentComplete ($counter / $files.count*100)}
      $copy
      $counter++
      {[System.Windows.Forms.MessageBox]::Show("Backup wykonał się poprawnie.")}
      }
       
      Best Regards and Thanks
      Keiishi
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9