locked
File copy operation from PowerShell that displays "Copy files" dialog RRS feed

  • Question

  • I need to copy a directory with many files to another directory. Actually, I will have an end-user do this. Is there a PowerShell "copy file" command that also displays the progress of the copy so the user knows what is happening? (otherwise for a long copy they may think the process has hung and re-submit the copy operation).

    TIA,

    edm2

    Wednesday, March 6, 2013 9:08 PM

Answers

All replies

  • Copy-Item -Source <source> -Destination <Destination> -Verbose

    Will print out everything copy-itm is doing


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.

    • Proposed as answer by Yan Li_ Monday, March 11, 2013 6:19 AM
    Wednesday, March 6, 2013 9:16 PM
  • You can copy a file and be notified if it failed.

    Copy-Item -Path 'c:\temp\doc.txt' -Destination 'c:\temp\dest -ErrorAction silentlyContinue
    if(-not $?) {write-warning "Your Copy Failed!"}
    else {write-host "Your copy was a Succes!"}

    CLS
    Write-Host "File is copying. Please wait...." -ForegroundColor Green
    Copy-Item -Path 'c:\temp\doc.txt' -Destination 'c:\temp\dest -ErrorAction silentlyContinue if(-not $?) {write-warning "Your Copy Failed!"} else {write-host "Your copy was a Succes!"}



    • Edited by zperryz Wednesday, March 6, 2013 9:20 PM
    • Proposed as answer by zperryz Wednesday, March 6, 2013 9:48 PM
    Wednesday, March 6, 2013 9:18 PM
  • Hi,

    In addition above suggestions, please also refer below thread:

    Progress bar for copied files in powershell

    http://social.technet.microsoft.com/Forums/en/winserverpowershell/thread/c957ca7a-088e-40fb-8ce6-23da4d0753bb

    progress-during-large-file-copy-copy-item-write-progress

    http://stackoverflow.com/questions/2434133/progress-during-large-file-copy-copy-item-write-progress

    Regards,

    Yan Li

    If you have any feedback on our support, please click here .


    Cataleya Li
    TechNet Community Support


    • Edited by Yan Li_ Monday, March 11, 2013 6:24 AM
    • Marked as answer by edm2 Tuesday, March 12, 2013 7:45 PM
    Monday, March 11, 2013 6:23 AM