I have an simple myscript.ps1
to extract URLs from files, taken from this tutorial:
$input_path = 'd:\myfolder\*'
$output_file = 'd:\extracted_URL_addresses.txt'
$regex = '([a-zA-Z]{3,})://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)*?'
select-string -Path $input_path -Pattern $regex -AllMatches | % { $_.Matches } | % { $_.Value } > $output_file
I run PowerShell as administrator and then type:
D:/myscript.ps1
But for most of the paths inside d:\myfolder
I get:
select-string : The file D:\myfolder\templates cannot be read: Access to the path 'D:\myfolder\templates' is denied.
The folder is copied from FTP server with WinSCP. I tried to go to folder properties and tick off "read only" box than apply but each time I re-enter the properties it's "read only" again (I'm not sure if that's related to the problem).
I work on Windows 10.