rename files
-
Fellow Notepad++ Users,
Could you please help me the the following search-and-replace problem I am having?
DESCRIBE CIRCUMSTANCES OF YOUR QUESTION
I would like to make these files available for download (or just for text viewing), but with the filenames changed—keeping only the part of the name that appears before the underscore.
Here is the data I currently have (“before” data):“C:\contest\cvadx\2024\CW\DL8FMA_8U5QC.txt”
“C:\contest\cvadx\2024\CW\DL8UKW_8WMM6.txt”
“C:\contest\cvadx\2024\CW\DL8UKW_RMXE3.txt”
“C:\contest\cvadx\2024\CW\DM1AA_6J2IN.txt”Here is how I would like that data to look ("after" data):“C:\contest\cvadx\2024\CW\DL8FMA.txt”
“C:\contest\cvadx\2024\CW\DL8UKW.txt”
“C:\contest\cvadx\2024\CW\DL8UKW.txt”
“C:\contest\cvadx\2024\CW\DM1AA.txt”very thanks
Francisco Freitas -
@francisco this is a classical task for a RegEx Search/Replace.
Open Replace Dialog and select “Regular Expression” as Search Mode. At “Find what” enter
^(.*)_[^.]*. At “Replace with” enter$1. Hit “Replace All”.You may want to have a look at https://npp-user-manual.org/docs/searching/#regular-expressions for an introduction to Regular Expression Searches. For further reading have a look at https://community.notepad-plus-plus.org/topic/15765/faq-where-to-find-regular-expressions-regex-documentation. You will find a lot of useful information and links there.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login