Tools For Renaming Files In Linux

  Рет қаралды 21,789

DistroTube

DistroTube

Күн бұрын

Пікірлер: 75
@nikolaizombie1
@nikolaizombie1 2 жыл бұрын
In bash there is a built in way to do the seq 10 | xargs command, it's called brace expansion. For example touch {1..12}.txt creates 12 files with the file sames 1 through 12.
@gizlikullanc4861
@gizlikullanc4861 2 жыл бұрын
I am sure DT knows that and still doing it in the long way. Because he knows someone is going to comment, "Hey there is better way" which will help him because that's how algorithm works. He knows how to play the game man :)
@lawrencedoliveiro9104
@lawrencedoliveiro9104 2 жыл бұрын
One interesting difference is that “{00..10}” automatically expands to 2-digit numbers with leading zeroes, whereas “seq 00 10” does not; you have to use something like “seq -f%02.0f 0 10”.
@xrafter
@xrafter 2 жыл бұрын
@@lawrencedoliveiro9104 Thanks. Why didn't you tell us that before.
@rufine4114
@rufine4114 Жыл бұрын
printf "%02d " $(seq 1 10) but I don't think that DT has used the long way so as to make people comment, he's probably done that because he's used to using fish and since fish doesn't follow the POSIX standard, he always have to do the long way
@lawrencedoliveiro9104
@lawrencedoliveiro9104 2 жыл бұрын
7:15 Tip for the find command: start by putting an “echo” as the first word after -exec, so it prints out the command instead of executing it. That helps you ensure it will do the right thing before turning it loose.
@RAndrewNeal
@RAndrewNeal 2 жыл бұрын
That's good advice for every potentially mass-destructive script/one-liner. I do it to debug my scripts before I actually use them.
@Danielddiniz
@Danielddiniz 2 жыл бұрын
Just here watching my favorite Linux YT channel! Thanks for the video Derek!
@DistroTube
@DistroTube 2 жыл бұрын
Wow, thanks!
@phrtao
@phrtao 2 жыл бұрын
Just a little aside - I worked for 10 years writing document management software and part of what I did was enforcing good naming conventions. It always amazed me just how lazy everyone was when it came to naming files even when legally required to do so. Despite having tools to do the work (scripts and applications) most files were still stored with non-descript default file names in arbitrary locations. The only time files were ever named appropriately was when they were automatically generated, even then the naming conventions still varied. File naming and location is still a big problem and people still believe that content searching will solve all their problems.
@FirstLast-cy8og
@FirstLast-cy8og 2 жыл бұрын
i have been fiddling with automating with bulk rename for several years. Glad someone tinkers with same things I do
@atps
@atps 2 жыл бұрын
Great and useful video. I usually rename single files with mv and bulk rename with vimv.
@gseidler
@gseidler 2 жыл бұрын
You missed my favorite bulk rename tool. Vidir from Moreutils. Also uses Vim to rename but more flexible than Vifm since you can pipe find results into it and can also at the same time move your files if you alter the file path along with the name.
@NOMAD3030
@NOMAD3030 2 жыл бұрын
Thanks for showing this kind of stuff. I've been using Linux a long time and still haven't learned bash very well.
@xrafter
@xrafter 2 жыл бұрын
You are a week late my friend, but never late than never. Thanks for this video.
@sbr895
@sbr895 2 жыл бұрын
This is the best Linux channel to follow if you want to be a power user👍
@bobtheblobou
@bobtheblobou 2 жыл бұрын
@Mr. Rich B.O.B ngl Luke Smith is just a weirdo lol. I used to watch him but his rants are kinda offputting.
@bobtheblobou
@bobtheblobou 2 жыл бұрын
@Mr. Rich B.O.B They are funny tbf lol. Although most of the times I'm laughing at him, rather than with him
@Chiren
@Chiren 2 жыл бұрын
You saved me a lot of time, thanks.
@bassernx
@bassernx 2 жыл бұрын
Probably worth noting that mv standard behavior is overwriting.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 2 жыл бұрын
One command I have used a fair bit is mmv. That does its own recognition of shell-style wildcards, substituting them into the output pattern. E.g. mmv -v '*.TXT' '#1.txt' renames files ending with .TXT to corresponding .txt, telling you what it’s renaming as it goes. It also provides the “-n” option, where it shows you what it would do without doing it.
@scheimong
@scheimong 2 жыл бұрын
A few days ago I needed to rename a bunch of files to randomly generated names but I didn't find an existing tool to do it, so I wrote a tool myself. It's a really niche need but if you ever want it for whatever reason, it's called rng-rename on GitHub. Written in rust too so hopefully that'll make aficionados happy
@scheimong
@scheimong 2 жыл бұрын
@@kuwandak that was one of the first things I tried. As far as I can tell, there is no "random character" feature (at least not trivially). I remember spending an hour or so trying to figure it out, but eventually just gave up. The advantage of writing my own software is ***I*** get to select the feature set. So for example in rng-rename you can easily select different character sets (numbers, letters, base16, base64, etc.) and the casing where applicable. It's very niche but it's what I need.
@kevinkane1234
@kevinkane1234 2 жыл бұрын
Qmv is a great terminal tool for renaming files
@richardlesperance8259
@richardlesperance8259 2 жыл бұрын
My rant on the linux community was not aimed at you! It was just a general hit!
@Zeratul123able
@Zeratul123able 2 жыл бұрын
damn bro, I wish you uploaded this a few days ago LOL
@gert9537
@gert9537 2 жыл бұрын
You might also mention gprename, a tool you can make quite complicated renames with :)
@dieman7ich
@dieman7ich 2 жыл бұрын
Double commander is most convenient tool for batch renaming of files. And it's basically most convenient file manager.
@janvojtko4037
@janvojtko4037 2 жыл бұрын
Once I spent the whole night trying to rename and sort images which I imported from my phone. They were pictures of school notes and some of them were incorrect orientation or incorrect order. Too bad you didn't show something like that, e.g. bulk image rotation or some sorting etc. Or when you have a list of files named 1.txt - 100.txt and you remove one file in the middle of the list, the rest of the files gets renamed
@shutdowncnn6086
@shutdowncnn6086 2 жыл бұрын
Renaming files in a folder to sequential numbers. I use the second below command all the time. ls -v | cat -n | while read n f; do mv -n "$f" "$n.mp3"; done Beauty in one line: ls -v | cat -n | while read n f; do mv -n "$f" "$n.ext"; done You can change .ext with .png, .jpg, etc.
@marioschroers7318
@marioschroers7318 2 жыл бұрын
My go-to is the batch rename feature in nnn where you simply use a vim buffer.
@KyleLanmon
@KyleLanmon 2 жыл бұрын
I'm triggered that you did not use i as your loop variable in the for loop example
@rahilarious
@rahilarious 2 жыл бұрын
finally some productive meaningful content from DT
@stephenguo7388
@stephenguo7388 2 жыл бұрын
I love regular expressions
@torsten.breswald
@torsten.breswald 2 жыл бұрын
hey dt, i gave my 70 year old dad a linux laptop because win11 won't run on his old one, now everything works fine except his music collection, where i wanted to bulk rename files for organizing, the thing is, win and linux and even different linux machines seem to order files in different ways which is very odd and kinda destroys his whole way to keep track of the music i have to say, his mp3s are named for sorting with spaces and numbers and letters, for example a song might be ' 11aab artist - title (year)' you know that game, but i didn't get it to sort them properly to rename them in bulk with some ongoing numbers, i think i could've figured it out with a little more time, but at that moment it put me kinda off would be cool if you could make a video about that to not have other new to linux users run into that issue peace
@gentoguy8749
@gentoguy8749 2 жыл бұрын
thank u for this lesson i have quistion sir why i cant faind any ui aplication to do this my nimo filemaneger come with bulky its bad app becase i hav gaint folder with defrent names so i had to use kde app called krenamer why i had to use tirminal for this simple task in windows all you had to do sellect all file then shose a name then boom every thing is perfect im really love linux but you guys dont understand the defrent between home user and job user if im home user I DONT NEED TIRMINAL Onley UI APP for any task how hard is that sir thank you
@svenkarlsen2702
@svenkarlsen2702 2 жыл бұрын
I just use mv... Sometimes with for-loops, a couple of variables and shell expand/replace functionality...
@phenelz1ne
@phenelz1ne 2 жыл бұрын
It's already shown in the video
@Ahmed-to9hi
@Ahmed-to9hi 2 жыл бұрын
Does it really need to be a 16min video for RENAMING FILES?
@ShiroIsMyName
@ShiroIsMyName 2 жыл бұрын
Yes, as it is a tutorial, and explaining clearly a subject takes time
@Foche_T._Schitt
@Foche_T._Schitt 2 жыл бұрын
I just use the batch rename tool in Xnview
@mkedzier123
@mkedzier123 2 жыл бұрын
I just use Total Commander to do any advanced file renaming.
@jonassbaptista
@jonassbaptista 2 жыл бұрын
You should give mmv utility a chance.
@gtdt5666
@gtdt5666 2 жыл бұрын
👍
@epicnan1855
@epicnan1855 2 жыл бұрын
i think the easiest way would be *touch {0..10}.txt* and *mv {0..10}.txt {0..10}.text*
@iAmTheWagon
@iAmTheWagon 2 жыл бұрын
Is there a simple one command way to swap two filenames?
@DistroTube
@DistroTube 2 жыл бұрын
It would involve three moves: mv file1 tmp && mv file2 file1 && mv tmp file2
@vagg1109
@vagg1109 2 жыл бұрын
@` "simple"
@kmp3e
@kmp3e 2 жыл бұрын
Create a bash function or shell script to do what DT comments said will be I little harder in the short form but easy in the long term
@PabloBianchiOK
@PabloBianchiOK 2 жыл бұрын
Instead ` m` you could `command ls`. Maybe easier to remember.
@Montegasppa
@Montegasppa 2 жыл бұрын
Ah! So you are a FishShell maniac too! 😂
@bendover4728
@bendover4728 2 жыл бұрын
Linux, the answer is always Linux.
@veirant5004
@veirant5004 2 жыл бұрын
Please, anybody, give me an example of a script which would rename anything in the directory to something like 01.jpg, 02.jpg, ..., 44.jpg, according to the specified file extension (.jpg in this case) in alphabet order. Otherwise it would keep a file untouched. I really need it.
@audiolatroushearetic1822
@audiolatroushearetic1822 2 жыл бұрын
If you only want to rename image files and you're ok with a easy to use gui solution, try 'gthumb'. It's a graphical image viewer/browser with many cool functions imo like xml-databases and batch renaming. You can mark the jpgs or filter them through filesearch, press F2 and choose different variables like 'new_name_##%E', so '#' is a placeholder for the count (you can start anywhere between 1 and 999...) and '%E' is for the original file extension. Then it should show someting like this: 'new_name_01.jpg; ...02.jpg; ...'. Works great for me. However if someone knows a skrip which can do the same to regular files or folders, I would be delighted as well to know about :).
@dreamcastspirit1386
@dreamcastspirit1386 2 жыл бұрын
What is alphabet order in this case. If the files are names 01 02 etc are they not already ordered like that? If I can get a little more info might be able to write something for you.
@veirant5004
@veirant5004 2 жыл бұрын
@@dreamcastspirit1386, let's say English but this is not always the truth. The gist is the tendency of torrents to have names of files like \[H264\]\ \(2020\)\ S07E05\ РАДУГА extension_here (youtube blocks me if I put a real extention there). Unacceptable, disgusting heap of gargabe, isn't it? In simple words, an alphabet order is the order of "ls" output. I made a Python script though, which plays it out the ordering together with bash. It slugifies filenames in the directory first and then does what it have to initially, however it turned out too dirty. I'd like to have some kind of alias, which does this, taking one simple relative path argument into it.
@MrLinNew
@MrLinNew 2 жыл бұрын
Does he start every video with "One of the most...."
@pup4301
@pup4301 2 жыл бұрын
Dang I made a simple tool for renaming files in a directory based on the ISO date standard. XXXX-XX-XX_(name) _(other numbered data) Still rust is more readable and I want to still be able to read my code after the fact.
@Chronian-bm2vu
@Chronian-bm2vu 2 жыл бұрын
Kali xfce
@OnlyMyisha
@OnlyMyisha 2 жыл бұрын
Just do "mv filename newname"
@elclippo4182
@elclippo4182 2 жыл бұрын
mv
@phenelz1ne
@phenelz1ne 2 жыл бұрын
Yes, it's already in the video
@anantgupta1188
@anantgupta1188 2 жыл бұрын
i just use mv command
@tommy8701
@tommy8701 2 жыл бұрын
First?
@Ma1ne2
@Ma1ne2 2 жыл бұрын
First!
@Danielddiniz
@Danielddiniz 2 жыл бұрын
🏆
@churchofsatan2041
@churchofsatan2041 Жыл бұрын
This is why windows is better for renaming. No one has time to do all that crap.
@bernard1475
@bernard1475 2 жыл бұрын
rename = rm
@jacksonmowry
@jacksonmowry 2 жыл бұрын
Lmao
@lipsic2303
@lipsic2303 2 жыл бұрын
rm /usr = easier way to rename
@Miguel_GM
@Miguel_GM 2 жыл бұрын
1:50 Even simplier: touch {1..10}.txt
@mikemarcum9407
@mikemarcum9407 2 жыл бұрын
one word: szyszka Try it! intuitive to a point but a mild learning curve to really get it right for directories full of 'odd names' you have or need to rename in order to make sense of them or maybe just for organizational purposes. btw, yes it's a gui app...
@mikemarcum9407
@mikemarcum9407 2 жыл бұрын
he'll NEVER use it... thinks everyone LOVES the command line as much as he does. sick...
@teachkhmerbinary
@teachkhmerbinary Жыл бұрын
seq 10 | xargs -I {} touch {}.txt it much more harder touch {1..10}.txt it is the easy one
@timschefer8393
@timschefer8393 2 жыл бұрын
mv
Commands To Shutdown And Reboot On Linux
10:57
DistroTube
Рет қаралды 32 М.
Essential Linux Commands - Cat, Tac and Tee
21:07
DistroTube
Рет қаралды 24 М.
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 275 #shorts
00:29
Will A Basketball Boat Hold My Weight?
00:30
MrBeast
Рет қаралды 121 МЛН
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 2,1 МЛН
Xargs Should Be In Your Command Line Toolbag
16:24
DistroTube
Рет қаралды 100 М.
The 5 Things That Taught Me The Most About Linux
18:41
DistroTube
Рет қаралды 95 М.
The 12 Linux Apps Everyone Should Know About
21:20
DistroTube
Рет қаралды 471 М.
Two Powerful Command Line Utilities 'cut' And 'tr'
15:18
DistroTube
Рет қаралды 33 М.
You NEED to try Hyprland on Linux RIGHT NOW
24:36
typecraft
Рет қаралды 151 М.
Learning Sed Is Beneficial For Linux Users
19:27
DistroTube
Рет қаралды 85 М.
vifm - The Terminal File Manager For The Vim-Centric User
24:07
DistroTube
Рет қаралды 76 М.
Doom Emacs On Day One (Learn These Things FIRST!)
35:10
DistroTube
Рет қаралды 176 М.
Learning Awk Is Essential For Linux Users
20:02
DistroTube
Рет қаралды 302 М.
Trying to do Simple Tasks on Linux lol - Daily Driver Challenge Pt.3
29:44
Linus Tech Tips
Рет қаралды 2,8 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 275 #shorts
00:29