1

A friend of mine took the liberty to remove all white-spaces " " in the foldernames on our shared drives and substitute them with the underline character "_" . The filenames are unaffected, and the error is systematic propagated in foldernames only

Any good proposal on which command could resolve this?

Thanks..!

root-11
  • 1,102

2 Answers2

2

If you really want to go back to spaces, here is the command, only for files

find /path -type f -iname '*_*' -exec bash -c 'echo mv -i "$1" "${1//_/ }"' _ {} \;

This only shows what would do, remove the echo to really exec.

Next you can change also directory substituting -type f with -type d.

enzotib
  • 96,093
2

Use the rename tool:

$ rename "_" " " */*/ */*/*/
cweiske
  • 3,395