Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save atelierbram/fe615d889f4c8547ac08ca53f86497c7 to your computer and use it in GitHub Desktop.
Save atelierbram/fe615d889f4c8547ac08ca53f86497c7 to your computer and use it in GitHub Desktop.
This command should rename files in subdirectories that don't have a suffix and don't contain a `?` character in their name by appending `.html`
find . -mindepth 1 -type f -not -name "*.*" -not -name "*\?*" -exec sh -c 'mv "{}" "{}".html' \;
# In this version, I've removed the -name '*.*' option, since we want to rename files that don't have a suffix.
# I've also replaced the -not -name '*\?' option with -not -name "*\?*",
# which should correctly exclude files that contain a ? character in their name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment