Comments
 
posted on June 7th 2019, at 11:22
by lunarg

If you need to rename all folders and files to lowercase on a case-sensitive filesystem (e.g. ext4 on linux), you can use the following at the bash prompt:

If rename is available (if you have Perl installed, then it usually is):

find . -depth -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;

If you can't use rename, try this:

for SRC in `find my_root_dir -depth`
do
    DST=`dirname "${SRC}"`/`basename "${SRC}" | tr '[A-Z]' '[a-z]'`
    if [ "${SRC}" != "${DST}" ]
    then
        [ ! -e "${DST}" ] && mv -T "${SRC}" "${DST}" || echo "${SRC} was not renamed"
    fi
done
Add a new comment
 
Your name:
Your e-mail:
Your comment:
 
Basic BBcode is supported.
Captcha:
Type the letters and numbers as shown.
/get/captcha/1714081007
Not readable? Get another.
 
 
 
 
« April 2024»
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
282930    
 
Links
 
Quote
« You only find out who is swimming naked when the tide goes out. »
Warren Buffett