Skip to content

Instantly share code, notes, and snippets.

@cbillowes
Last active October 11, 2018 16:26
Show Gist options
  • Save cbillowes/7c3f3f6de72ba9e92ad4c31c7410e072 to your computer and use it in GitHub Desktop.
Save cbillowes/7c3f3f6de72ba9e92ad4c31c7410e072 to your computer and use it in GitHub Desktop.
Unhide linux files
#!/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