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.
@gizlikullanc48612 жыл бұрын
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 :)
@lawrencedoliveiro91042 жыл бұрын
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”.
@xrafter2 жыл бұрын
@@lawrencedoliveiro9104 Thanks. Why didn't you tell us that before.
@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
@lawrencedoliveiro91042 жыл бұрын
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.
@RAndrewNeal2 жыл бұрын
That's good advice for every potentially mass-destructive script/one-liner. I do it to debug my scripts before I actually use them.
@Danielddiniz2 жыл бұрын
Just here watching my favorite Linux YT channel! Thanks for the video Derek!
@DistroTube2 жыл бұрын
Wow, thanks!
@phrtao2 жыл бұрын
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.
@atps2 жыл бұрын
Great and useful video. I usually rename single files with mv and bulk rename with vimv.
@gseidler2 жыл бұрын
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.
@FirstLast-cy8og2 жыл бұрын
i have been fiddling with automating with bulk rename for several years. Glad someone tinkers with same things I do
@NOMAD30302 жыл бұрын
Thanks for showing this kind of stuff. I've been using Linux a long time and still haven't learned bash very well.
@sbr8952 жыл бұрын
This is the best Linux channel to follow if you want to be a power user👍
@bobtheblobou2 жыл бұрын
@Mr. Rich B.O.B ngl Luke Smith is just a weirdo lol. I used to watch him but his rants are kinda offputting.
@bobtheblobou2 жыл бұрын
@Mr. Rich B.O.B They are funny tbf lol. Although most of the times I'm laughing at him, rather than with him
@xrafter2 жыл бұрын
You are a week late my friend, but never late than never. Thanks for this video.
@bassernx2 жыл бұрын
Probably worth noting that mv standard behavior is overwriting.
@Chiren2 жыл бұрын
You saved me a lot of time, thanks.
@lawrencedoliveiro91042 жыл бұрын
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.
@janvojtko40372 жыл бұрын
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
@scheimong2 жыл бұрын
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
@scheimong2 жыл бұрын
@@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.
@KyleLanmon2 жыл бұрын
I'm triggered that you did not use i as your loop variable in the for loop example
@marioschroers73182 жыл бұрын
My go-to is the batch rename feature in nnn where you simply use a vim buffer.
@kevinkane12342 жыл бұрын
Qmv is a great terminal tool for renaming files
@gentoguy87492 жыл бұрын
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
@Miguel_GM2 жыл бұрын
1:50 Even simplier: touch {1..10}.txt
@svenkarlsen27022 жыл бұрын
I just use mv... Sometimes with for-loops, a couple of variables and shell expand/replace functionality...
@phenelz1ne2 жыл бұрын
It's already shown in the video
@richardlesperance82592 жыл бұрын
My rant on the linux community was not aimed at you! It was just a general hit!
@rahilarious2 жыл бұрын
finally some productive meaningful content from DT
@dieman7ich2 жыл бұрын
Double commander is most convenient tool for batch renaming of files. And it's basically most convenient file manager.
@gert95372 жыл бұрын
You might also mention gprename, a tool you can make quite complicated renames with :)
@shutdowncnn60862 жыл бұрын
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.
@Zeratul123able2 жыл бұрын
damn bro, I wish you uploaded this a few days ago LOL
@iAmTheWagon2 жыл бұрын
Is there a simple one command way to swap two filenames?
@DistroTube2 жыл бұрын
It would involve three moves: mv file1 tmp && mv file2 file1 && mv tmp file2
@vagg11092 жыл бұрын
@` "simple"
@kmp3e2 жыл бұрын
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
@torsten.breswald2 жыл бұрын
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
@veirant50042 жыл бұрын
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.
@audiolatroushearetic18222 жыл бұрын
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 :).
@dreamcastspirit13862 жыл бұрын
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.
@veirant50042 жыл бұрын
@@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.
@Foche_T._Schitt2 жыл бұрын
I just use the batch rename tool in Xnview
@mkedzier1232 жыл бұрын
I just use Total Commander to do any advanced file renaming.
@stephenguo73882 жыл бұрын
I love regular expressions
@gtdt56662 жыл бұрын
👍
@Ahmed-to9hi2 жыл бұрын
Does it really need to be a 16min video for RENAMING FILES?
@ShiroIsMyName2 жыл бұрын
Yes, as it is a tutorial, and explaining clearly a subject takes time
@PabloBianchiOK2 жыл бұрын
Instead ` m` you could `command ls`. Maybe easier to remember.
@jonassbaptista2 жыл бұрын
You should give mmv utility a chance.
@epicnan18552 жыл бұрын
i think the easiest way would be *touch {0..10}.txt* and *mv {0..10}.txt {0..10}.text*
@Montegasppa2 жыл бұрын
Ah! So you are a FishShell maniac too! 😂
@MrLinNew2 жыл бұрын
Does he start every video with "One of the most...."
@Chronian-bm2vu2 жыл бұрын
Kali xfce
@bendover47282 жыл бұрын
Linux, the answer is always Linux.
@anantgupta11882 жыл бұрын
i just use mv command
@elclippo41822 жыл бұрын
mv
@phenelz1ne2 жыл бұрын
Yes, it's already in the video
@Neatrice2 жыл бұрын
Just do "mv filename newname"
@tommy87012 жыл бұрын
First?
@Ma1ne22 жыл бұрын
First!
@Danielddiniz2 жыл бұрын
🏆
@churchofsatan2041 Жыл бұрын
This is why windows is better for renaming. No one has time to do all that crap.
@stdprocedure22 күн бұрын
you can do all of that "crap" on windows too, except linux most of the time has nicer syntax
@bernard14752 жыл бұрын
rename = rm
@jacksonmowry2 жыл бұрын
Lmao
@lipsic23032 жыл бұрын
rm /usr = easier way to rename
@mikemarcum94072 жыл бұрын
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...
@mikemarcum94072 жыл бұрын
he'll NEVER use it... thinks everyone LOVES the command line as much as he does. sick...
@teachkhmerbinary Жыл бұрын
seq 10 | xargs -I {} touch {}.txt it much more harder touch {1..10}.txt it is the easy one