lukebarone

Untitled

May 13th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $string="https://pek3a.qingstor.com/ecourse/marking/00609226-733e-4843-a91c-2636d0785b7f/000001.jpg
  2. https://pek3a.qingstor.com/ecourse/marking/00609226-733e-4843-a91c-2636d0785b7f/000003.jpg
  3. https://pek3a.qingstor.com/ecourse/marking/03f6c818-b4f9-4deb-854d-1aa01767e7be/000045.jpg
  4. https://pek3a.qingstor.com/ecourse/marking/03f6c818-b4f9-4deb-854d-1aa01767e7be/000047.jpg
  5. https://pek3a.qingstor.com/ecourse/marking/03f6c818-b4f9-4deb-854d-1aa01767e7be/000049.jpg"
  6. $files = $string.Split([string[]]"`r`n", [StringSplitOptions]::None)
  7. foreach($file in $files){
  8.     $dir = [regex]::Match($file,"(?<=/)[^/]+(?=/[^/]+$)").value
  9.     if( -Not (Test-Path $dir)){
  10.         New-Item $dir -ItemType Directory
  11.     }
  12.      $fileToOutput = Join-Path -Path (pwd).Path -ChildPath ([regex]::Match($file,"(?<=/)[^/]+$").value)
  13.      Invoke-WebRequest $file -OutFile $fileToOutput
  14. }
Advertisement
Add Comment
Please, Sign In to add comment