Batch remove files to remove spaces:


This will remove spaces and replace them with a dash:
for file in *; do mv "$file" `echo $file | tr ' ' '-'` ; done

This will remove spaces, then underscores with a dash:
for file in *; do mv "$file" `echo $file | tr ' ' '-'` ; done && for file in *; do mv "$file" `echo $file | tr '_' '-'` ; done

Source | Date: June 1st 2024


Back

© 2019 to 2025 Branden Gilfoil & © up to 2025 for respective owners.