Skip to content

Instantly share code, notes, and snippets.

@MeenachiSundaram
Created May 12, 2017 06:46
Show Gist options
  • Save MeenachiSundaram/a38b2f0cf837935ea93a8ca45e4ea31e to your computer and use it in GitHub Desktop.
Save MeenachiSundaram/a38b2f0cf837935ea93a8ca45e4ea31e to your computer and use it in GitHub Desktop.
file_name_conventions
#!/bin/sh
# change file name containing space to _
for file in *
do
mv "$file" `echo $file | tr ' ' '_'`
done
# lowerit
# convert all file names in the current directory to lower case
# only operates on plain files--does not change the name of directories
# will ask for verification before overwriting an existing file
# credits: http://www.linuxjournal.com/content/convert-filenames-lowercase
for x in `ls`
do
if [ ! -f $x ]; then
continue
fi
lc=`echo $x | tr '[A-Z]' '[a-z]'`
if [ $lc != $x ]; then
mv -i $x $lc
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment