Creation of multiple directories

I have a folder structure like the below

/test/test1/test2/app
/test/test3/app
/test/test4/test5/app
..

I need to create a new folder under "app" in all the above listed directory structure at one shot by the name "subapp" .

How can we acheive this using a script .

New to unix scripting hence request the direction .

Thanks all .

 find /test -type d -name "app" -exec mkdir {}/subapp \;

Hi , Thanks for the quick reply .

But getting a error when i try to test it out ..

$ pwd
/tmp/rajesh
$ cd fol1
$ ls -ltr
total 0
drwxr-xr-x    2 wmuser   wmftp           256 May 11 17:28 sub
$ cd ../fol2
$ ls -ltr
total 0
drwxr-xr-x    2 wmuser   wmftp           256 May 11 17:28 sub
$ cd ../fol3
$ ls -ltr
total 0
drwxr-xr-x    2 wmuser   wmftp           256 May 11 17:29 sub
$ find /tmp/rajesh -type d -name "sub" -exec mkdir {}/subapp \;
mkdir: 0653-357 Cannot access directory {}.
{}: A file or directory in the path name does not exist.
mkdir: 0653-357 Cannot access directory {}.
{}: A file or directory in the path name does not exist.
mkdir: 0653-357 Cannot access directory {}.
{}: A file or directory in the path name does not exist.
$

Hi.

Try with xargs:

find . -type d -name sub | xargs -I{} mkdir {}/subapp
1 Like

THANKS scottn , It works .

Thanks all the quick replies .