MacOS command executes command recursively
I've tried a lot of things about object renaming. I found out that the following command proved to be efficient and correct:
for f in *; do mv "$f" "`echo $f | tr ‘:’ '_'`"; done
Unfortunately this command does not work recursivley.
My "target" folder for this command is share / Volumes / Share / Work \ Data /. Is there a "simple" way to do this recursively?
Dan
+3
source to share
2 answers
You can use find
with bash replacement:
find . -name "*:*" -exec bash -c 'echo "$0" "${0//:/_}"' {} \;
The above command will dry run the move operation. When you are sure that the files are named the way you want to replace echo
with mv
, to actually move / rename the files recursively.
+2
source to share