LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-12-2006, 12:32 AM   #1
[FragMax]genesis
LQ Newbie
 
Registered: Apr 2006
Posts: 9

Rep: Reputation: 0
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.
 
Old 10-12-2006, 01:13 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,356

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
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
 
Old 10-12-2006, 10:59 AM   #3
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,544
Blog Entries: 4

Rep: Reputation: 57
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
 
Old 10-13-2006, 09:17 PM   #4
[FragMax]genesis
LQ Newbie
 
Registered: Apr 2006
Posts: 9

Original Poster
Rep: Reputation: 0
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....?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Samba can create new files and folders but access denied in any new folders k.king Linux - Networking 2 01-15-2006 06:14 AM
how do I create links to folders? liontamer13 Linux - Newbie 2 12-18-2004 03:05 AM
cant save or create files/folders on drives. felonius Linux - Newbie 9 11-07-2004 03:18 PM
folders/subfolder permissons demmylls Linux - General 1 11-22-2003 05:25 AM
Thru WS-FTP, valid user can't go into folders they create krzykard Linux - Software 2 11-12-2003 05:44 PM


All times are GMT -5. The time now is 11:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration