I need to recursively rename bash-sdl2-compile.sh to compile.sh
Attempts to use 'rename' fail, apparently a security feature doesn't allow the 'bash' word i.e.
find ./ -name "bash-sdl2-compile.sh" -print0 | xargs -0 rename "bash-sdl2-compile.sh" "bash-sdl2-compile/compile"
error message: Bareword "bash" not allowed while "strict subs" in use at (user-supplied code). xargs: rename: exited with status 255; aborting
How can I recursively rename linux files?
dir1
|_project1
|_ bash-sdl2-compile.sh
dir2
|_project2
|_ bash-sdl2-compile.sh
dir3
|_project3
|_ bash-sdl2-compile.sh
. . .
So, rename each "bash-sdl2-compile.sh" to just "compile.sh"
No need to use xargs
, find
is enough:
find . -name bash-sdl2-compile.sh -execdir mv -i {} compile.sh ";"
(make a backup of your whole tree before trying this)