I need to scan all directories & files ander / directory And to rename the host - "node1" with "node_STAR" in file name or directory name
Can some one have brilliant idea how to do that maybe with find or perl ( in order to insert this to my shell script) Any way it's must be very fast in spite we scananing all Linux directories and files
example on - file
/var/tmp/node1 will be /var/tmp/node_STAR file
example on - directory
/etc/my_hosts/node1 will be /etc/my_hosts/node_STAR dir
Something like:
Since passing the filenames via a backtick-call of find might fail if the number of affected files is large, it's better to use xargs:
This command will replace all file and directory names containing the string
node1
starting at the current directory (.
). If you want to replace only exact file names, remove the asterisks from the find parameter, and to restrict it to files or directories, use the parametertype -f
ortype -d
respectively.