You are not logged in.

#1 2006-09-17 10:12:47

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

mass renaming to lowecase?

it is possible quickly renaming many files including subfolders to lowercase?[/b]

Offline

#2 2006-09-17 11:00:03

smoon
Member
Registered: 2005-08-22
Posts: 468
Website

Re: mass renaming to lowecase?

First two matches from Google:
http://webxadmin.free.fr/article/shell- … we-135.php
http://gentoo-wiki.com/TIP_lowercase_fi … irectories
:shock:

So the easiest way is to install convmv:

# pacman -Sy convmv

and run it:

% convmv -r --notest --lower DIRECTORY

Offline

#3 2006-09-18 06:22:41

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: mass renaming to lowecase?

I made some time ago a bash script for this job. It also can remove or substitute space character. This works to directories too as they are special files.

Note: In the script is a sed command that makes _-_ to - conversion.

#!/bin/bash
# Convert filenames to lowercase
# and replace characters
##################################

find . -depth -name '*' | while read file ; do
        directory=$(dirname "$file")
        oldfilename=$(basename "$file")
        newfilename=$(echo "$oldfilename" | tr 'A-Z' 'a-z' | tr ' ' '_' | sed 's/_-_/-/g')
        if [ "$oldfilename" != "$newfilename" ]; then
                #echo "$directory/$oldfilename" "$directory/$newfilename"
                mv -i "$directory/$oldfilename" "$directory/$newfilename"
                #echo "$directory"
                #echo "$oldfilename"
                #echo "$newfilename"
                #echo
        fi
        done
exit 0

link to script

Offline

#4 2006-09-18 06:47:11

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

Re: mass renaming to lowecase?

@smoon
thanks!

@Purch
Nice! I never used tr that way, really nice.

Offline

#5 2006-09-18 07:51:48

matersci
Member
From: Hellas
Registered: 2006-01-19
Posts: 169

Re: mass renaming to lowecase?

There is also Krename in community

Offline

#6 2006-09-18 14:49:16

xerverius
Member
From: ~
Registered: 2004-11-02
Posts: 230
Website

Re: mass renaming to lowecase?

One word: Thunar big_smile

Offline

#7 2006-09-19 11:14:01

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: mass renaming to lowecase?

goooooogle! ;-) (and man rename).

Offline

Board footer

Powered by FluxBB