LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Create a subfolder in several folders (https://www.linuxquestions.org/questions/linux-newbie-8/create-a-subfolder-in-several-folders-491656/)

[FragMax]genesis 10-12-2006 12:32 AM

Create a subfolder in several folders
 
Hey guys,

I have a situation where I need to create a subfolder called "subfolder" under several folders with different names.

I tried mkdir *\subfolder, it errors out on the ones that already have "subfolder" but does not really create the subfolder for the ones that don't have it.

Any help is appreciated.

gen.

chrism01 10-12-2006 01:13 AM

One way is to put list of dirs in a file eg dir.lst, then:
Code:

for dir in `cat dir.lst`
do
    mkdir ${dir}/subdir
done


cs-cam 10-12-2006 10:59 AM

Another way if the list isn't too huge:
Code:

# notice i skipped dir3 & dir6 - you said it existed in some
mkdir /path/to/{dir1,dir2,dir4,dir5,dir7}/subfolder


[FragMax]genesis 10-13-2006 09:17 PM

There's a lot of folders, so how do I create a list of folders? Are they supposed to be one per line or delimited....?


All times are GMT -5. The time now is 07:27 AM.