Skip to content

Simple bash script that replaces filenames' whitespaces for underscores

License

Notifications You must be signed in to change notification settings

chibby0ne/spaces_to_underscores

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Spaces to Underscores

Found myself fighting with the escaped spaces in the shell, one to many times.

Renames files in the given directory, by replacing groups of adjacent whitespaces with an underscore (_).

Usage

When it finds something to rename:

meeseeks@home:~/test_dir $ ./spaces_to_underscores.sh .
Changed a dir to a_dir
Changed a  file to a_file

When it doesn't find something to rename:

meeseeks@home:~/test_dir $ ./spaces_to_underscores.sh .
No files with spaces. No files renamed.

When the given directory is not searchable by the current user:

meeseeks@home:~/test_dir $ ./spaces_to_underscores.sh .
No files with spaces. No files renamed.
meeseeks@home:~/test_dir $ ./spaces_to_underscores.sh .
Cannot search root_dir directory. Check directory permissions.

License

MIT

About

Simple bash script that replaces filenames' whitespaces for underscores

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages