write a script that will check each folder/directory and rename the folder title if it contains the word “section.” The folder should be renamed to use the word “chapter” instead of “section”;Your script should be recursive, executing on each directory, subdirectory, and lower subdirectory, until all child directories have been checked and renamed.
For example:
supersectiondir-->subsectiondir-->lowersubsectiondir
should become:
superchapterdir-->subchapterdir-->lowersubchapterdir
My attempt (from directory above supersectiondir):
find /c/Users/cmd2/supersection -type d -exec sed -i 's/section/chapter/g' {} \;
$ sh renaming.sh
sed: couldn't edit /c/Users/cmd2/supersection: not a regular file
sed: couldn't edit /c/Users/cmd2/supersection/subsection: not a regular file
sed: couldn't edit /c/Users/cmd2/supersection/subsection/lowersubsection: not a regular file
Try this this will solve the problem
– Piyush Jain Mar 22 '16 at 10:04find -name '*section*'
do mv $file ${file//section/chapter} done – jayinee desai Mar 23 '16 at 04:12