Bash script to replace spaces in file names
Posted
by armandino
on Stack Overflow
See other posts from Stack Overflow
or by armandino
Published on 2010-04-25T18:53:31Z
Indexed on
2010/04/25
19:03 UTC
Read the original article
Hit count: 311
Can anyone recommend a safe solution to recursively replace spaces with underscores in file and directory names starting from a given root directory? For example,
$ tree . |-- a dir | `-- file with spaces.txt `-- b dir |-- another file with spaces.txt `-- yet another file with spaces.pdf
becomes
$ tree . |-- a_dir | `-- file_with_spaces.txt `-- b_dir |-- another_file_with_spaces.txt `-- yet_another_file_with_spaces.pdf
© Stack Overflow or respective owner