crp Posted March 24, 2022 Posted March 24, 2022 I've been using linux for about 25 years. seriously, i purchased RH2 on cd's. never as my main system but either as a plaything, a workstation when a gui wasn't needed or (mostly) as a server. Today i found out something which if i did know before i totally forgot. Have a directory with multiple csv files, all starting with "sesamm" and followed by between 3-5 characters. I needed to rename them to "waesle"-whatever. no problem , i figured. in DOS i would do ren sesamm*.csv waesle*.csv so i'll just do mv sesamm*.csv waesle*.csv Nope! That does not work. One gets an error message about a directory waesle123.csv not existing. Linux does not have a built in command to rename multiple files with one shot. In the end i did them one-by-one. (doing it with for was way too complicated for me to try without testing and debugging.) Quote
securitybreach Posted March 25, 2022 Posted March 25, 2022 Of course you can: https://linuxconfig.org/how-to-rename-multiple-files-on-linux Quote
securitybreach Posted March 25, 2022 Posted March 25, 2022 And https://phoenixnap.com/kb/rename-file-linux Quote
securitybreach Posted March 25, 2022 Posted March 25, 2022 Using find or mv may be easier for you. The second links gives multiple ways of renaming multiple files on linux. Quote
crp Posted March 25, 2022 Author Posted March 25, 2022 like i posted , Linux does not have a built in command to rename multiple files at the same time. one needs to install a separate utility or use scripting. Quote
securitybreach Posted March 25, 2022 Posted March 25, 2022 mv is a built in unix command and find is preinstalled (via findutils) on most all distros. Technically Linux is just the kernel, the the rest are apps. Quote
sunrat Posted March 25, 2022 Posted March 25, 2022 for loops are awesome. I've worked out a couple ( sometimes with help) that save me heaps of time for actions I do often. And usually quite easy to understand and test. That said, I usually use the Multi Rename Tool utility in Double Commander for multiple file renaming. 1 Quote
V.T. Eric Layton Posted March 26, 2022 Posted March 26, 2022 For single files, mv works quite well. 1 Quote
abarbarian Posted March 28, 2022 Posted March 28, 2022 Quote Thunar includes a bulk renamer which can be run separately using the command Thunar -B or from within Thunar by selecting two or more files in the main area and pressing F2 or choosing 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.