Skip to content

Instantly share code, notes, and snippets.

@HT-7
Created March 14, 2023 15:33
Show Gist options
  • Save HT-7/8ed1ee6e0630f772d1393a2e9ffdecab to your computer and use it in GitHub Desktop.
Save HT-7/8ed1ee6e0630f772d1393a2e9ffdecab to your computer and use it in GitHub Desktop.
This Linux command replaces characters of file names that Windows considers invalid with an underscore, to make the files accessible and manageable on Windows again. Renamed files are logged to record their original names.
rename -v "s/(:|\"|\*|\\|\||\&|\?|\%|\<|\>)/_/g" .* * |tee -a renamed_files.$(date +%Y%m%d%H%M%S).log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment