Last active
October 11, 2018 16:26
-
-
Save cbillowes/7c3f3f6de72ba9e92ad4c31c7410e072 to your computer and use it in GitHub Desktop.
Unhide linux files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#print usage | |
if [ -z $1 ];then | |
echo "Usage :$(basename $0) parent-directory" | |
exit 1 | |
fi | |
for name in $1/.*; do | |
if [ $(dirname "${name}") != "." ]; then | |
new_name="$(dirname ${name})/$(basename "${name}" | cut -c 2-)" | |
echo "Renaming" $(dirname ${name})/$(basename "${name}") "to" ${new_name} | |
mv "${name}" "${new_name}" | |
fi | |
done | |
exit 0 | |
# inspired by https://www.tecmint.com/rename-all-files-and-directory-names-to-lowercase-in-linux/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment