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