An open API service indexing awesome lists of open source software.

https://github.com/chibby0ne/spaces_to_underscores

Simple bash script that replaces filenames' whitespaces for underscores
https://github.com/chibby0ne/spaces_to_underscores

bash script underscore whitespaces

Last synced: about 1 month ago
JSON representation

Simple bash script that replaces filenames' whitespaces for underscores

Awesome Lists containing this project

README

          

# 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