Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Rename Filename removing end-part

$
0
0
Hi,

I have around 200 txt files in a directory, all files have a "_" and a datestamp in the end of the filename. Is there any single-line command available that i can use to eliminate the "_" + date-part from the file names?

samples:
a1transactions_20140207.txt
b2post_20140207.txt
w32records_20140207.txt

You can see filenames are varying in number of letters in beginning, but the end-part always same which is "_yyyyMMdd". I want to remove this end-part.

After the rename, files should name like:
a1transactions.txt
b2post.txt
w32records.txt



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>