Skip to content

Instantly share code, notes, and snippets.

@itsmunim
Last active August 29, 2015 14:26
Show Gist options
  • Save itsmunim/3791998302ad219b51ad to your computer and use it in GitHub Desktop.
Save itsmunim/3791998302ad219b51ad to your computer and use it in GitHub Desktop.
Rename all the folders inside current folder(where this shell script will reside) with a specified suffix.
for FILENAME in *
do
a="$FILENAME"
if [[ $a != *"$1"* && -d "$a" ]]
then
mv "$a" "$a$1"
else
"Not renaming $a"
fi
done
@itsmunim
Copy link
Author

itsmunim commented Aug 4, 2015

Rename all the folders inside current folder with a specified suffix. Call Format : ./rename_dirs Suffix

N.B. Give it execution permission beforehand - chmod +x rename_dirs.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment