Jump to content
Diaverso Carrasco

How To Make Files All Lower Case

Recommended Posts

I am trying to start a server on linux.
But I have the problem that I have files in uppercase

 

This is what the directory contains

9PQAXUZ.png

 

If I run these commands inside the directory, I get this

find . -depth -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;
find "$PWD" -type f -name '*.pbo' -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;
find "$PWD" -depth -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;

XKdAWAH.png

 

If I meter inside any @

and inside the addons folder and run the command again, I get the same error

Share this post


Link to post
Share on other sites

I run this bash script inside my mods folder:

 

#!/bin/bash
depth=0
for x in $(find . -type d | sed "s/[^/]//g")
do
if [ ${depth} -lt ${#x} ]
then
   let depth=${#x}
fi
done
echo "the depth is ${depth}"
for ((i=1;i<=${depth};i++))
do
  for x in $(find . -maxdepth $i | grep [A-Z])
  do
    mv $x $(echo $x | tr 'A-Z' 'a-z')
  done
done

Works for me. My server is a Ubuntu server with LinuxGSM.

Share this post


Link to post
Share on other sites

I'm using steamcmd, but this is what I use.
 

#!/bin/bash

#$1 = id
#$2 = name

mod=$(cat pathmod)
arma=$(cat patharma)

#normalize addons folder
if [ -n "$(docker exec -t arma-s ls $mod/$1 | grep -o 'Addons')" ]; then
docker exec -t arma-s mv $mod/$1/Addons $mod/$1/addons
fi

#normalize pbo names
for pname in $(docker exec -t arma-s ls $mod/$1/addons | grep -io "[A-Z0-9a-z._-]*")
do

npname=$(echo $pname | tr [A-Z] [a-z])
if [ "$pname" != "$npname" ]; then
docker exec -t arma-s  mv $mod/$1/addons/$pname $mod/$1/addons/$npname
fi

done

#link
docker exec -t arma-s ln -sT $mod/$1 "$arma/mods/lns/$2"

honestly you don't really need the if statements, you can just take Addons and all of it's contents and run them through tr. I thought the easiest way to do it was to grab everything with ls and scrape off all the non-printing characters with grep.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×