I need to elaborate a little bit more. These commands are actually for a BBS FTN tosser. The configuration file for which these commands reside in, only allow specific declarations. Here are a few examples:
exec "/home/imp/imp/poll.sh" *.su? *.mo? *.tu? *.we? *th? *.fr? *.sa? *.pkt
flag toss!.now [0-9a-Z][0-9a-Z][0-9a-Z][0-9a-Z][0-9a-Z][0-9a-Z][0-9a-Z][0-9a-Z].???
exec "/home/imp/imp/poll.sh /home/imp/hpt/secure" /home/imp/hpt/secure/*.[STFWMstfWM][ouaherOUAHER][0-9A-ZA-a] *.[pP][kK][tT]
So that's why I want to use that syntax ([0-9a-z] (for example)).
The problem is that the mailer is looking for lowercase filenames, but only uppercase filenames exist.
I'm trying to convert a file from uppercase to lowercase using the syntax below:
mv /home/imp/hpt/outbound/[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z].[STFWMfWM][OUAHER][0-9] /home/imp/hpt/outbound/[0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z].[stfwm][ouaher][0-9a-za-a]
I don't think I have the syntax correct.
Here's an example of a file name I want to rename:
0000FE70.FR0
Any and all help is greatly appreciated.
Thanks.
Best Answer
Whenever you want to change one class of characters into another, use
tr
.The script will rename all files in the current directory to all lowercase letters. It will skip directories. Remove the
echo
when you're certain it does what you want. You may replace[:upper:]
and[:lower:]
withA-Z
anda-z
respectively if you only have standard ASCII filenames (note:A-Z
, not[A-Z]
).Alternatively, using Bash's built-in upper-to-lowercase variable substitution: