How to move .txt file so avi and txt has the same names - Printable Version +- Linux-Noob Forums (https://www.linux-noob.com/forums) +-- Forum: Linux Noob (https://www.linux-noob.com/forums/forum-3.html) +--- Forum: Tips and Tricks (https://www.linux-noob.com/forums/forum-59.html) +---- Forum: Filesystem Management (https://www.linux-noob.com/forums/forum-26.html) +---- Thread: How to move .txt file so avi and txt has the same names (/thread-1272.html) |
How to move .txt file so avi and txt has the same names - jerzykiller - 2007-07-05 1. I would like to say hello to everyone, because it is my first post :) 2. Some people are watching a lot of movies with subtitles. On example me :P Sometimes downloaded from some sites .txt file doesn't have the same name like ours .avi file. It's tiring to change these names in any gui application or even in console(usually there is a lot of other files like .rar, .r01...etc with similiar names). So I wrote this very little bash script which does that. Code: #!/bin/bash It will work only if in present dir is only one .txt and .avi file, and if these files names doesn't insist any spaces. I didn't know how to make it working with spaces. If anyone know, please let me know. I hope it may be usefull for someone :] How to move .txt file so avi and txt has the same names - znx - 2007-07-05 A slight modification, to allow you to specify the file and you can actually use a pure bash method (rather than with basename) and do: Code: #!/bin/bash Using *.avi, might lead to issues if you have multiple avi files in the one directory. Also note the quotes, to ensure spaces are still fine! Sexy first post none the less ;) How to move .txt file so avi and txt has the same names - jerzykiller - 2007-07-06 Thanks for help with this script. I actually always have one .txt and one .avi file (example below), and it is hard to type full name of txt file and avi file, because there are a lot of *.r?? files with similiar names. But that's in my case :] Code: orenji-the.4400.403.r00 I'd use a lot of TAB's and I'd have to look really close for every dots, numbers and other things in the names ;P I'm going to try to improve my script witch quotes. It didn't work for me before :P But maybe this time I do this right. Thanks again :] |