7
rated 0 times
[
7]
[
0]
/ answers: 1 / hits: 24606
/ 3 Years ago, tue, july 6, 2021, 4:17:45
I am trying to rename all files in a folder replacing underscores with spaces.
i.e. this_is_a_test --> this is a test
but somehow I'm messing up the quoting
> for file in * ; do echo mv -v $file $(echo $file | sed 's/_/ /g') ; done
mv -v this_is_a_test this is a test
that looks OK, but if I remove the 'echo' mv
complains as if the backslashes were removed
> for file in * ; do mv -v $file $(echo $file | sed 's/_/ /g') ; done
mv: target ‘test’ is not a directory
Can someone point out the error of my ways?
More From » command-line