awk, sed: one liner command for removing spaces from _all_ file names in a given folder?

Viewed 9546

Before:

eng-vshakya:scripts vshakya$ ls
American Samoa.png                  Faroe Islands.png                   Saint Barthelemy.png

After:

eng-vshakya:scripts vshakya$ ls
AmericanSamoa.png                   FaroeIslands.png                    SaintBarthelemy.png

Tried below prototype, but it does not work :( Sorry, not very good when it comes to awk/sed :(

ls *.png | sed 's/\ /\\\ /g' | awk '{print("mv "$1" "$1)}'

[ Above is prototype, real command, I guess, would be:

ls *.png | sed 's/\ /\\\ /g' | awk '{print("mv "$1" "$1)}' | sed 's/\ //g'

]

2 Answers
Related