**NOTE** January 2022 - Changes to Gstreamer and Pipewire packages from PackmanPlease read the following thread about the current changes
-
? renaming files using the command line
In principle the command line would be a mighty tool to rename files,
but I just don't seem to know the right commands,
and google searches in that respect don't seem to be very elucidating.
The problem:
I have to rename about 500 files.
The file names have upper case letters, and I would like to change them
to lowercase letters.
So I thought that commands like
Code:
mv CMBSY*.* cmbsy*.*
would be a good idea, but then I get
Code:
mv: given destination „cmbsy*.*“ is not a directory
(translated).
On the other hand, using
Code:
rename CMBSY*.* cmbsy*.*
there aren't any complaints, but just as well, NOTHING happens.
Even DOS had the command `ren' that would have made it,
but with bash / Linux ?
For many of you this probably is a trivial task.
Thanks
Mike
-
Re: ? renaming files using the command line
On Mon, 02 Dec 2013 20:06:01 +0000, ratzi wrote:
> So I thought that commands like
man rename
mv (move) doesn't accept wildcards. Rename does:
rename [from] [to] [wildmat]
For example, given a directory with files:
text1.txt
text2.txt
text3.txt
text4.txt
If you want to rename them so the files are:
file1.txt
file2.txt
file3.txt
file4.txt
the command is:
rename text file text*.txt
Jim
--
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
-
Re: ? renaming files using the command line
Jim Henderson wrote:
> For example, given a directory with files:
>
> text1.txt
> text2.txt
> text3.txt
> text4.txt
>
> If you want to rename them so the files are:
>
> file1.txt
> file2.txt
> file3.txt
> file4.txt
>
> the command is:
>
> rename text file text*.txt
>
Thanks, Jim. For all the time I've been using Linux, I never realized that
the proper command format was more of a simple text string replacement op
than a fullname-to-fullname operation!
--
Will Honea
-
Re: ? renaming files using the command line
Hi Jim!
rename in my case didn't seem to work,
see 1st post.
May be that is because I just want to replace uppercase letters
in the filenames by lowercase letters, whithout changing the
file name truely itself.
Thank you
Mike
-
Re: ? renaming files using the command line
What did you try, exactly? It can do this too but your use of 'rename'
was incorrect so follow Jim's example to have it work:
Code:
--------------------
rename CMBSY cmbsy CMBSY*
--------------------
--
Good luck.
If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below...
-
Re: ? renaming files using the command line
Hi ratzi,
If doing it on CLI isn't mandatory, just to get the job done you may try krename from OSS repo (supposed you use KDE).
It has many functions and one of them is to just change the name into lower case letters. I have just checked.
rds
kasi
PS:
I know the I-want-to-get-this-working-in-exacly-that-way-!-feeling. Should this apply, just feel free to ignore to above advice.
-
Re: ? renaming files using the command line
On Mon, 02 Dec 2013 21:09:51 +0000, Will Honea wrote:
> Thanks, Jim. For all the time I've been using Linux, I never realized
> that the proper command format was more of a simple text string
> replacement op than a fullname-to-fullname operation!
That's what happens when you have a CLI geek helping out. 
Jim
--
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
-
Re: ? renaming files using the command line
On Mon, 02 Dec 2013 21:26:01 +0000, ratzi wrote:
> Hi Jim!
>
> rename in my case didn't seem to work,
> see 1st post.
>
> May be that is because I just want to replace uppercase letters in the
> filenames by lowercase letters, whithout changing the file name truely
> itself.
You used wildcards in your example. Don't do that. As ab said, you need
to use the proper format - your example uses "rename [from] [to]" using
wildcards, and that is incorrect. Wildcards go in the third parameter,
which is actually a filespec. The first two are, as Will says, just
strings denoting the old string value and the new string value to change
it to.
Jim
--
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
-
Re: ? renaming files using the command line
 Originally Posted by hendersj
On Mon, 02 Dec 2013 20:06:01 +0000, ratzi wrote:
> So I thought that commands like
man rename
mv (move) doesn't accept wildcards. Rename does:
rename [from] [to] [wildmat]
For example, given a directory with files:
text1.txt
text2.txt
text3.txt
text4.txt
If you want to rename them so the files are:
file1.txt
file2.txt
file3.txt
file4.txt
the command is:
rename text file text*.txt
Jim
Hi Jim, hi Will,
to me the form of the command is really unusually.
But it works !
Before renaming, from ls, I have the file names
Code:
CMR10.pfb CMR12.pfb CMR17.pfb CMR5.pfb CMR6.pfb CMR7.pfb CMR8.pfb CMR9.pfb
Then I enter the command
Code:
rename CMR cmr CMR*.pfb
Afterwards 'ls' gives
Code:
cmr10.pfb cmr12.pfb cmr17.pfb cmr5.pfb cmr6.pfb cmr7.pfb cmr8.pfb cmr9.pfb
Sorry Jim, if I didn't get you immediately.
Thanks a lot
Mike
-
Re: ? renaming files using the command line
On Mon, 02 Dec 2013 23:36:01 +0000, ratzi wrote:
> Sorry Jim, if I didn't get you immediately.
That's OK - you got it this time around. 
Jim
--
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|