Skip to main content

Renaming hundreds of non-empty directories [Resolved]

OS is Centos 7

I've looked for a couple days now and feel like I should have found something for this by now.

I have hundreds and hundreds of directories like the following:

/tmp/user1/app/webapp/foo/bar.txt
/tmp/user2/app/webapp/etc/bar1.txt
/tmp/user3/app/webapp/whatever/bar2.txt
/tmp/user4/app/webapp/sure/bar3.txt

And I need to change 'webapp' to 'new_webapp'

Both /tmp/ and /app/ are constant but the users and the content under the directory to be renamed is unknown and varied. Every existing directory structure is not empty.

I have not found a way to succinctly do this without manually slogging through each directory with a laborious shuffling of files in and out of directories and I'm hoping someone might know of a more efficient way.


Question Credit: user2752794
Question Reference
Asked July 20, 2019
Tags: rename
Posted Under: Unix Linux
8 views
2 Answers

Your Answer
D:\Adnan\Candoerz\CandoProject\vQA