I have a bunch of files and directories containing white spaces (several of them in each file name) and I'm trying to remove them. I am plagged with the 'dumb'
rename that does not understand regex. So far I end up with something like
find . -maxdepth 1 -type d -print0 | perl -pe 'print $_; s/\s+/_/g' | xargs -n 2 -0 mv
trying to combine the power of
find (for now I wanted to rename only the first level of directories; I tried to circumvent the issue of
xargs using spaces as separator with
-print0) and of Perl regex.
It is going in the right direction (if I change
echo in the end I kinda get what I want) but it does not work completely.
Any generic suggestion would be appreciated!