LinuxQuestions.org
Latest LQ Deal: Linux Power User 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-02-2003, 12:30 PM   #1
jse580
LQ Newbie
 
Registered: Oct 2003
Posts: 9

Rep: Reputation: 0
Creating subdirectories within multiple exisitng direcotries


I'm trying to add a few new subdirectories to about 2000 existing project
directories. Anyone have any suggestions?

Thanks
 
Old 10-02-2003, 12:39 PM   #2
doublefailure
Member
 
Registered: Mar 2002
Location: ma
Distribution: slackware
Posts: 747

Rep: Reputation: 30
identical subdirectories for the 2000 directories?

if so, it can be done in scripting language just about in 5lines i guess
 
Old 10-02-2003, 12:41 PM   #3
jse580
LQ Newbie
 
Registered: Oct 2003
Posts: 9

Original Poster
Rep: Reputation: 0
I figured it was probably pretty simple. Could you post some kind of sample that I could work from?

Thanks
 
Old 10-02-2003, 12:55 PM   #4
doublefailure
Member
 
Registered: Mar 2002
Location: ma
Distribution: slackware
Posts: 747

Rep: Reputation: 30
bah, i haven't written scripting for about 6month..
hope someone else can give u an answer..
 
Old 10-02-2003, 01:00 PM   #5
dstivers
LQ Newbie
 
Registered: Oct 2003
Posts: 3

Rep: Reputation: 0
There are lots of ways to do this;

2000 is too many arguments for a single command line,
and probably too many for a for i in *; do , so the simplest would be to create a script and run that, e.g., if your shell is bash (which it almost certainly is) you can to this in one line, in the directory containing the directories...

Code:
sh <( find . -type d -maxdepth 1 -not -name \. | xargs -i echo 'mkdir -p {}/newdir/with/some/funny/sub/dirs' )
which will make the directory hierarchy 'newdir/with/some/funny/sub/dirs' in each of the directories in the current directory.

to see what this executes, replace sh with cat

 
Old 10-02-2003, 01:18 PM   #6
jse580
LQ Newbie
 
Registered: Oct 2003
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks

That was exactly what I was looking for
 
  


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
Creating Multiple Log Files koacamper Linux - Newbie 3 09-24-2005 08:24 PM
executing a script in multiple subdirectories jerryfreak Linux - Newbie 1 04-19-2005 09:34 PM
Creating multiple POP3 accounts jobokoth Linux - General 1 10-04-2003 10:06 AM
creating pub direcotries for users? sk8guitar Linux - General 11 10-04-2003 09:26 AM
script for creating multiple users d3funct Programming 1 08-21-2001 06:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:52 AM.

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