Reputation: 29
I have a host of files in a folder that are named as a string. I've found some information similar to what I'm trying to do here. I am not replacing existing characters in the string. I would just like to add Quote_ to the beginning of each file name. I have about 1500-2000 files that need altering.
Thanks!
Upvotes: 0
Views: 355
Reputation: 3082
All you need to do is (for current directory):
Get-Childitem | % { Rename-Item $_ "Quote_$_"}
It will add Quote_
to the beginning of every filename in directory you're using cmdlet in.
To ommit files that already have Query_
in their names, we can use simple clause to ommit them before replace:
Get-ChildItem | Where-Object { $_ -NotMatch "Quote_" } | % { Rename-Item $_ "Quote_$_"}
Upvotes: 2