Skip to content

Instantly share code, notes, and snippets.

@vifon
Last active June 15, 2018 00:27
Show Gist options
  • Save vifon/1b0b6ca63d306d8fcad0064e5bde67b9 to your computer and use it in GitHub Desktop.
Save vifon/1b0b6ca63d306d8fcad0064e5bde67b9 to your computer and use it in GitHub Desktop.
Toggle the leading dot in files
#!/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