changing file names

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
The previous post showed how (with a script and a command)
to search a directory tree and change all occurances of
underscore to dash inside the files.

What if you want to change directory names?
What if you want to change file names?

    find $1 -depth -name '*_*' -type d -print |
     sed 's/./\&/g' |
     awk -F/ -vOFS=/ '
         gsub(/_/, "-", $NF)
         system("<&3 mv -i -- " old " " new)

} 3<&0

...use the same script, but change -type d to -type f

Re: changing file names

the previous post, about changing file names recursively,
to swap underscores to dashes, was supposed to be a reply
to darnel's post in the "When is the Next PR update" thread.
Stuff happens.

Site Timeline