Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell change extension

I have a problem with change extension of a file. I need to write a script which is replicating data, but data have two files. Filename is not a string, so we can't use normal -replace

I need to get from

filename.number.extension

this form

filename.number.otherextension

We try to use a split, but this command show us things like below

filename
number
otherextension

Thanks for any ideas,

like image 946
Sebastian Jarosz Avatar asked Jul 13 '26 01:07

Sebastian Jarosz


1 Answers

[System.IO.Path]::ChangeExtension('test.old', '.new')
like image 191
Florian Wachs Avatar answered Jul 14 '26 20:07

Florian Wachs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!