I can run dos2unix
on one file in PowerShell:
dos2unix ./assets/style.css
How to do this for all CSS files under ./assets/
and its subdirectories?
I can run dos2unix
on one file in PowerShell:
dos2unix ./assets/style.css
How to do this for all CSS files under ./assets/
and its subdirectories?
'.\assets' | Get-ChildItem -Recurse -File -Filter '*.css' | ForEach-Object {
dos2unix $_.FullName
}
Get-ChildItem
is like dir
or ls
(in powershell the latter 2 are aliases for that cmdlet).
-File
means return only files.
-Recurse
means recurse child directories.
-Filter
allows us to get only the file pattern desired.
Then we pipe that into ForEach-Object
to execute a script block for each file returned and in there, we just execute the dos2unix command.
FullName
is the property of the file object that contains the full path to the file.