I am trying to use the Rename-Item
cmdlet to do the following:
I have folder which contains "*.txt" files. Let's say 1.txt, 2.txt etc...
I want to copy files that have some prefix, rename them to *.txt and override any existing files if there are any.
example:
folder: c:\TEST
files : 1.txt, 2.txt, 3.txt, 4.txt, 5.txt, index.1.txt, index.2.txt, index.3.txt, index.4.txt, index.5.txt
I want to use rename-item to filter any index.*.txt
and rename them to *.txt
, and if the same file exists, replace it.
Thank you guys