[Samba] file names convert

Michael Wood esiotrot at gmail.com
Thu Sep 16 05:38:05 MDT 2010


On 16 September 2010 09:02, Alessio Tomelleri - ARPAV Dipartimento di
Belluno <atomelleri at arpa.veneto.it> wrote:
>  ..maybe could be useful this command ?!  get a closer look   "man tr"
> tr [:upper:] [:lower:] < myfile

He wants to change the filename, not the contents :)

> maybe, inserting it in a script as well...

Try something like:

for f in *; do
    lower="`echo $f | tr [:upper:] [:lower:]`"
    if [ "$f" != "$lower" ]; then
        mv -i "$f" "$lower"

The "mv -i" is in case you have a file called "README.txt" and another
one called "Readme.txt" in the same directory.

Please try it out on some test files before running it in production.

> Il 16/09/2010 08:19, Engi Zoltán ha scritto:
>>  On 2010.09.15. 16:32, Volker Lendecke wrote:
>>> On Wed, Sep 15, 2010 at 08:39:17AM +0200, Engi Zoltán wrote:
>>>> I have Samba network with debian linux lenny server and 3 windows
>>>> clients.
>>>> Some of users save the files with uppercase, for example "Xlsx". How
>>>> can J have Samba to do convert files names into lowercase.
>>>> I am beginner in Samba.
>>> Try
>>> case sensitive = no
>>> short preserve case = no
>>> preserve case = no
>>> default case = lower
>>> Volker
>> Thanks, for your help.
>> How can I rename old files on linux server with one command?
>> I would like to get every files and directory names are lowercase.

Michael Wood <esiotrot at gmail.com>

More information about the samba mailing list