Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 851  / 2 Years ago, sun, october 16, 2022, 12:47:39

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..!


More From » files

 Answers
7

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.


[#41613] Monday, October 17, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sconhoney

Total Points: 403
Total Questions: 118
Total Answers: 109

Location: Andorra
Member since Mon, Jan 9, 2023
1 Year ago
sconhoney questions
;