Last active
June 15, 2018 00:27
-
-
Save vifon/1b0b6ca63d306d8fcad0064e5bde67b9 to your computer and use it in GitHub Desktop.
Toggle the leading dot in 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/zsh | |
for file in "$@"; do | |
if [[ "$file:t" = .* ]]; then | |
mv -v -- "$file" "${file:h}/${${file:t}#.}" | |
else | |
mv -v -- "$file" "${file:h}/.${file:t}" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment