Rename all subtitles files with the same name of mp4 files in same folder

paste -d: <(ls -1 *.mp4) <(ls -1 *.srt) | while read line; do movie="${line%%:*}"; subtitle="${line##*:}"; mv "${subtitle}" "${movie%.*}.srt"; done
Use this command if you want to rename all subtitles for them to have the same name as the mp4 files. NOTE: The order of "ls -1 *.mp4" must match the order of "ls -1 *.srt", run the command bellow to make sure the *.srt files will really match the movies after run this command: paste -d:

7
2020-11-08 02:47:13

What Others Think

Shouldn't `echo $line be `echo "$line" ?
rautamiekka · 23 weeks ago
@rautamiekka Actually no, because "echo" command will just print out all the contents of the variable, so it will never run into white space issues. But with the "mv" command we need it. I updated the command to be more reliable with white space in file names. I added the quotes anyway Best ;)
ricardofunke · 22 weeks and 6 days ago
We actually don't need no "echo" here... =/
ricardofunke · 22 weeks and 6 days ago
Tried this and deleted the subs from the folder. Fortunately, it was just 1 file but still.
Moltke · 22 weeks and 5 days ago
This so helpful for me now can easily convert the names of file and can exist different mp4 files with the same name Ecommerce web development dubai
Faisal · 22 weeks and 5 days ago
It does work! Thanks a lot for this! SEO companies Tampa
brielleluna · 22 weeks and 4 days ago
this and deleted the subs from the folder. Fortunately, it was just [url=http://www.surecleanonline.co.uk/]surecleanonline.co.uk[/url] . [url=http://www.clearanceworld.org.uk/]clearanceworld.org.uk[/url] . [url=http://www.carpetcleaningproductorlando.us/]house clearances[/url] . [url=https://thefrisky.com/choosing-right-biohazard-clean-service/]biohazard cleaning[/url]
saeed20 · 22 weeks and 3 days ago
guitar lessons spokane Wow! I did not know you can use ipad that way! This is interesting
yeoyeo · 22 weeks and 2 days ago
I really loved reading your blog. It was very well authored and easy to undertand. Unlike additional blogs I have read which are really not tht good. I also found your posts very interesting. In fact after reading. I had to go show it to my friend and he ejoyed it as well! ????
KayGasaway · 22 weeks and 1 day ago
This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. HOT MEN CAPS Mercado Livre
hiknigarde · 22 weeks ago
Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. best climber machine
KayGasaway · 22 weeks ago
This particular papers fabulous, and My spouse and i enjoy each of the perform that you have placed into this. I’m sure that you will be making a really useful place. I has been additionally pleased. Good perform! ?????
KayGasaway · 21 weeks and 4 days ago
howdy, your websites are really good. I appreciate your work. SILDENAX
hiknigarde · 21 weeks and 2 days ago
This particular papers fabulous, and My spouse and i enjoy each of the perform that you have placed into this. I’m sure that you will be making a really useful place. I has been additionally pleased. Good perform! ?????
KayGasaway · 21 weeks ago
great! works well. thanks for this fencingwichitaks.com
looneyhans · 20 weeks and 5 days ago
The book has a lot of knowledge, but not everyone wants to spend time writing an essay, and for this, I recommend you a wonderful site https://papernow.org/book-reports that will help you write any written work.
Shouressunt · 20 weeks and 3 days ago
I'm constantly searching on the internet for posts that will help me. Too much is clearly to learn about this. I believe you created good quality items in Functions also. Keep working, congrats! CBD Nugs
KayGasaway · 20 weeks and 3 days ago
this is really good! bathroomremodelboise.com
Killersmile · 20 weeks and 2 days ago
Way to go! Great post thanks ! keep on posting! Seamless gutter installation
Chaddychaddy · 19 weeks and 5 days ago
This is a very interesting blog post. welldrillingmidlandtx.com/well-maintenance-inspection
keywave110 · 19 weeks and 3 days ago
I love the way you write and share your niche! Very interesting and different! Keep it coming! Order Ayahuasca UK
KayGasaway · 19 weeks and 1 day ago
Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing ????
Emilybacklink · 19 weeks ago
I agree with you. This post is truly inspiring. montgomerycountytree.com
keywave110 · 18 weeks and 5 days ago
Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. 50% naked
hiknigarde · 18 weeks and 2 days ago
Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing sklepy motoryzacyjne szczecin
KayGasaway · 18 weeks and 1 day ago
You guardians do an astounding web diary, and have some unfathomable substance. Continue doing extraordinary. https://crownhostel.ru
KayGasaway · 18 weeks and 1 day ago
I needed to thank you for this phenomenal read!! I unquestionably adored each and every piece of it. I have you bookmarked your site to look at the new stuff you post. http://198.54.126.216">judi online
KayGasaway · 18 weeks and 1 day ago
Wow, this is really interesting reading. I am glad I found this and got to read it. Great job on this content. I like it. landscaping near me
KayGasaway · 18 weeks ago
I love significantly your own post! I look at all post is great. I discovered your personal content using bing search. Discover my webpage is a great one as you.I work to create several content this post. Once more you can thank you and keep it create! Enjoy! remax listings decatur tx
KayGasaway · 18 weeks ago
Hi there, I found your blog via Google while searching for such kinda informative post and your post looks very interesting for me. discover this info here
KayGasaway · 17 weeks and 6 days ago
This was a shocking post. It has some look at here fundamental data on this subject. produit
KayGasaway · 17 weeks and 6 days ago
Just stopped saving the subs separately as takes too much space and difficult to mach with mp4. At least got me some time to look for cv now review as looking for a job ha ha
ira34 · 17 weeks and 5 days ago
awesome site thanks for this! www.hairextensionsspokanewa.com
looneyhans · 17 weeks and 5 days ago
I truly value this superb post that you have accommodated us. I guarantee this would be helpful for a large portion of the general population. hong kong tvp
KayGasaway · 17 weeks and 5 days ago
This was a shocking post. It has some look at here fundamental data on this subject. app developer hong kong
KayGasaway · 17 weeks and 5 days ago
thanks for this love this breast augmentation omaha ne
looneyhans · 17 weeks and 4 days ago
It is an excellent blog, I have ever seen. I found all the material on this blog utmost unique and well written. And, I have decided to visit it again and again. REDUTROL PREÇO
hiknigarde · 17 weeks and 4 days ago
I just hope that this will work on my end. affordableseoservice.org
ChrisC · 16 weeks and 6 days ago
Hmm. Looks pretty good. Isnt it? fort smith concrete contractors click here
LucilleM · 16 weeks and 6 days ago
Thank you so much for sharing this.. I will try it today. fashion tutorials
diplo777 · 16 weeks and 6 days ago
??? ?????? ?????????? ?????? ? ????????????? ??????????? ???. ??, ??????? ??? ???? ???? ????? ???????? ? ???? ?????. ?????? ? ???? ? ? ?????? ???? ?????) ? ??????? ????? 50 ??. ? ????????? ?? ???????? ? 80 ?? ?? 50 ?? 2 ??????, ??????????? ?? ???????? ??????? ??????.
val11 · 16 weeks and 3 days ago
seo little rock love this soo much!
idasanka · 16 weeks and 2 days ago
This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. find" rel="nofollow">http://personeriadebarranquilla.gov.co/?option=com_k2&view=itemlist&task=user&id=3107'>find this
bojokey283 · 15 weeks and 6 days ago
This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. find this http://personeriadebarranquilla.gov.co/?option=com_k2&view=itemlist&task=user&id=3107
bojokey283 · 15 weeks and 6 days ago
Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. industrial Automation
bojokey283 · 14 weeks and 4 days ago
This was really an interesting topic and I kinda agree with what you have mentioned here! coronavirus holbox
bojokey283 · 14 weeks and 3 days ago
home care oakland This is the only site the helped me
yeoyeo · 14 weeks and 3 days ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. las vegas carpet cleaning
bojokey283 · 13 weeks and 4 days ago
Thank you for the information. Foundation Repair Wichita KS
Harvey01 · 11 weeks and 5 days ago
Really a great addition. I have read this marvelous post. Thanks for sharing information about it. I really like that. Thanks so lot for your convene. cpanel license
bojokey283 · 11 weeks and 3 days ago
I love this peace
sammm · 11 weeks and 2 days ago
Glad to found this amazing information. Itsupportfortlauderdale.net
Mark01 · 11 weeks and 2 days ago
had been in the search of what i have got today! cuaconriverside
healer45 · 11 weeks and 2 days ago
Glad to read your article, looking forward to sharing your adventures and experiences and expect a quality work! ?????
healer45 · 11 weeks and 1 day ago
This is just the information I am finding everywhere. Thanks for your blog, I just subscribe your blog. This is a nice blog.. https://www.shopfloor-analytics.de/
bojokey283 · 11 weeks and 1 day ago
Interesting topic for a blog. I have been searching the Internet for fun and came upon your website. Fabulous post. Thanks a ton for sharing your knowledge! It is great to see that some people still put in an effort into managing their websites. I'll be sure to check back again real soon. isla mujeres things to do
bojokey283 · 10 weeks and 6 days ago
I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. schlüsseldienste köln
bojokey283 · 10 weeks and 4 days ago
This video amazon fba business has something which will definitely expand your education and imagination,which will eventually make you more visionary!
healer45 · 10 weeks and 2 days ago
Throughout my internet journey gone through with so many articles and blogs I rarely found such characteristics! Vingroup
healer45 · 10 weeks and 1 day ago
Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing playa del carmen
bojokey283 · 9 weeks and 1 day ago
Great job for publishing such a beneficial web site. tellthebell
HintonTuck1 · 7 weeks and 4 days ago
I’m and so blessed to own found out the following site. People essentially claimed all of us simply just what exactly When I opted to help pay attention to help in addition to afterward a lot of. Appreciation from [drywall bend](https://centraloregondrywall.com/)
jackslesly19 · 7 weeks and 3 days ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. rumah pintar
bojokey283 · 7 weeks and 1 day ago
I tried it but it fails, I think I missed the command, how tricky it was, I should be careful. -Josh drywall contractors
vassist960 · 6 weeks and 3 days ago
Good job posting this kind of article. https://thebestcbdcreams.com/the-best-cbd-oil-for-sciatica/
lesliechan20 · 6 weeks and 2 days ago
I tried it but it prompt error. huntington's disease
pamelaban · 6 weeks and 2 days ago
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. https://www.islandlifemexico.com/best-of-cozumel/
xoheko1229 · 6 weeks and 1 day ago
Thanks for sharing this valuable content. In my view, if all webmasters and bloggers made good content as you did, the web will be a lot more useful than ever before. Cheers from buildinginspectorsnewcastle.com.au
johnlead · 5 weeks and 6 days ago
Nice post. I was checking constantly this blog and I’m impressed! Extremely useful info specially the last part I care for such information a lot. I was seeking this certain info for a long time. Thank you and good luck. best thing to do in cancun
xoheko1229 · 5 weeks and 4 days ago
I appreciate everything you have added to my knowledge base.Admiring the time and effort you put into your blog and detailed information you offer.Thanks. holbox cancun
xoheko1229 · 5 weeks and 1 day ago
Thank you so much for sharing this great blog.Very inspiring and helpful too.Hope you continue to share more of your ideas.I will definitely love to read. best hotel in holbox
xoheko1229 · 5 weeks and 1 day ago
Throughout my internet journey gone through with so many articles and blogs I rarely found such characteristics! Grand Marina
tamvu2019 · 4 weeks ago
For someone new like me, you've introduced the topic to this website fairly effectively that I can easily grasp your points. I look forward to more practical entries in this like this. thanks :)
jackslesly19 · 3 weeks and 6 days ago
Great articles and great layout. Your blog post deserves all of the positive feedback it’s been getting. treatnheal
xoheko1229 · 3 weeks and 2 days ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. Automatyka domowa
bojokey283 · 2 weeks and 5 days ago
Wow, I didn't know that this kind of command exist. Thank you so much for sharing this tips with us. tree service
ogilview82 · 2 weeks and 4 days ago
business voip he then shot a very last-spherical 76 on the carmel, ind., path on wednesday to finish in a tie for 2nd with a 4-over 220, 4returned of winner john marshall butler.i played super,” daly ii advised the indianapolis megastar. “it'd had been cool to win, however i still have time. just a couple horrific 3-putts each days, however apart from that i played incredible.
anttone · 2 weeks and 4 days ago
Great site! I wish I found this much earlier private investigator san diego
aegyjingoo · 2 weeks and 2 days ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. bathroom vanity
bojokey283 · 1 week and 6 days ago
I think you know how much effort has been put into your work. Your writing is very informative and interesting. Your suggestions have perfectly succeeded my task. ?????
rkskekfk · 1 week and 2 days ago
I think you know how much effort has been put into your work. Your writing is very informative and interesting. Your suggestions have perfectly succeeded my task. https://www.caa-il.com/
rkskekfk · 1 week and 2 days ago
Thank you for sharing your information with us. I will share your writing on my website to let my friends know. Surely everyone will love it. https://www.nuestra-cocina.com/
rkskekfk · 1 week and 2 days ago
Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging.. covid mexico
bojokey283 · 5 days ago
It's my pleasure to find this amazing website that provides mostly unseen information about every single topic which is I really like. You can also try to visit this website here's the link https://reliableroofingredmond.com
jackslesly19 · 4 days ago
Thank you so much for the post you do. I like your post and all you share with us is up to date and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job. How to get to Hualien from Taipei
bojokey283 · 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: