Quantcast
Viewing latest article 3
Browse Latest Browse All 4

Answer by janos for Bulk renaming of camelcase files to include spaces

The problem is that the $(...) sub-shell in your command is evaluated at the time you run the command, and not evaluated by xargs for each file. You could use find's -exec instead to evaluate commands for each file in a sh, and also replace the quoting appropriately:

find . -name "*[a-z][A-Z]*" -type f -exec sh -c 'echo mv -v "{}" "$(echo "{}" | sed -E "s/([a-z])([A-Z])/\1 \2/g")"' \;

If the output of this looks good, drop the echo in echo mv. Note that due to echo | sed, this won't work with filenames with embedded \n. (But that was an already existing limitation in your own attempt, so I hope that's acceptable.)


Viewing latest article 3
Browse Latest Browse All 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>