Local to server

Welcome Forums General PowerShell Q&A Local to server

This topic contains 1 reply, has 2 voices, and was last updated by

Senior Moderator
1 month, 3 weeks ago.

  • Author
  • #168739

    Topics: 1
    Replies: 0
    Points: -9
    Rank: Member

    Hello all,

    I have to create a script that moves all the files on the desktop, downloads and documents from the computer of the user to the server. What is the best way to do this?

  • #168850

    Senior Moderator
    Topics: 8
    Replies: 1041
    Points: 3,439
    Helping Hand
    Rank: Community Hero

    didn't get you on what you meant by the best way.

    You would use Get-ChildItem and Move-Item cmdlet to do this. Those three folders are special folder so you can address them using

    $Desktop = [environment]::GetFolderPath([System.Environment+SpecialFolder]::Desktop)
    $Documents = [environment]::GetFolderPath([System.Environment+SpecialFolder]::MyDocuments)
    $Personal = Split-Path -Path ([environment]::GetFolderPath([System.Environment+SpecialFolder]::Personal))
    $Downloads = Join-Path -Path $Personal -ChildPath 'Downloads'

You must be logged in to reply to this topic.