Welcome Forums General PowerShell Q&A Local to server

Viewing 1 reply thread
  • Author
    Posts
    • #168739
      Participant
      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: 1158
      Points: 4,045
      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'
      
Viewing 1 reply thread
  • The topic ‘Local to server’ is closed to new replies.