Bulk rename all 'filename.mp3?NonsenseString' to 'filename.mp3'
Sometimes when I download podcasts with newsbeuter+podbeuter I get files of the form:
Code:
filename.mp3?NonsenseString Code:
mv filename.mp3?NonsenseString filename.mp3 What is the most straightforward way of doing this? EDIT: Just wanted to add an example: 2017-07-12-symhc-bill-berry.mp3?awCollectionId=1002&awEpisodeId=927933 |
If you fancy using a GUI approach, then pyRenamer is a cool utility.
In this case, you would select the pattern of {X}? replaced by {1}. That deletes all characters in selected filenames after the question mark, including the question mark, so would cover both oggs and mp3s. Note that as it is, it only deletes everything after the ultimate question mark in the filename, but unless you're expecting to find multiple question marks in filenames you should be fine. |
I'm not super experienced with sed but I think you could try something like
Code:
cd /path/to/your/folder I'm sure others will have other suggestions |
You can try using the rename program. -n is "dry-run" mode.
This matches the "?" and everything after and renames it with nothing as demoed below Code:
$ rename -v -n 's/[?].*//g' 201* |
Quote:
Thank you so much, it worked like a charm. Highly appreciated! |
All times are GMT -5. The time now is 02:52 AM. |