Copy Files listed in a text file to an External Disk preserving the folder

Welcome Forums General PowerShell Q&A Copy Files listed in a text file to an External Disk preserving the folder

Viewing 2 reply threads
  • Author
    Posts
    • #184604
      Participant
      Topics: 1
      Replies: 0
      Points: 12
      Rank: Member

      I need time to time to export files listed in txt file with the full path to an External Drive preserving the folder structure. Sometimes are hundreds of files so i'm looking for an automation but i don't know powershell.

      If i need to export everything within a directory i canĀ  use Robocopy with the MIR option but most of the time i need only to copy some files from a directory...some from other....etc....

      There is a way to read the file with powershell and for each line run a Robocopy to a destination folder?

    • #184631
      Participant
      Topics: 10
      Replies: 117
      Points: 457
      Helping Hand
      Rank: Contributor

      You'll have a few options in this recent thread: https://powershell.org/forums/topic/robocopy-powershell/

    • #184673
      Participant
      Topics: 1
      Replies: 1639
      Points: 3,104
      Helping Hand
      Rank: Community Hero

      https://social.technet.microsoft.com/Forums/de-DE/3b269a35-5497-4a2f-b081-6a11ef573881/copy-file-from-a-file-list-preserving-directories?forum=winserverpowershell

      As mentioned there – there is is no built in way to achieve what you're asking for. You will have to "extract" the part of the path you want to preserve from the source file path and create that part of the path in the destination root before you can copy the file into this newly created folder.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.