why the following command " find / -name 'node1' -print0 | xargs -0 rename 's/node1/node_STAR/' " not replace the node1 under /var/tmp directory?
my target is to scan linux sys and rename directories and files
example from my linux machine
pwd
/var/tmp/Change_host_dir
find / -name '*node1*' -print0 | xargs -0
/var/tmp/Change_host_dir/node1
find / -name '*node1*' -print0 | xargs -0 rename 's/node1/node_STAR/'
ls
node1
try with
The standard linux
rename
command man page says:so it's just for simple file renames. This is the standard rename from util-linux, available on all linux systems I am aware of.
I think you are probably trying to use Larry Wall's example perl rename script. If that's what you really want, create this file in your path:
make it executable with
chmod 755 rename
, and call it instead of the system rename. I tested it with your example and it works.