Need script to make big directory structure


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need script to make big directory structure
# 1  
Old 11-07-2005
Need script to make big directory structure

Hi,

I'm a novice and I'd like to make a directory structure with a hundred or so folders. I've tried mkdir /foo/foo1/etc...

mkdir /foo/foo2/etc
mkdir /foo/foo3/etc
mkdir /foo/foo4/etc

...but it appends '@' to each folder name and then fails on the subdirectories. Is it better to use a looping command to repeat mkdir and then loop thru a list of folder names in an external txt file for example?

Thanks, Keith.
# 2  
Old 11-07-2005
try using 'mkdir -p ....'

quoting 'man mkdir':
Code:
     -p        With this option, mkdir  creates dir  by  creating
               all the non-existing parent directories first. The
               mode given to intermediate directories will be the
               difference  between  777  and  the bits set in the
               file mode creation mask. The difference,  however,
               must be at least 300 (write and execute permission
               for the user).

# 3  
Old 11-07-2005
Thanks. That helped.

Thanks. That helped.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Make directory in script

I'm creating a file that reads: cd $HOME echo What would you like to call the tar file? read TARNAME tar -cf $TARNAME.tar labs/* mkdir backups mv $TARNAME.tar backups/ Now my problem I'm having is that some people have the backups directory and some don't. How can I make it that if they... (1 Reply)
Discussion started by: bbowers
1 Replies

2. Shell Programming and Scripting

Script that creates directory structure

Hi All, I have a script that does daily checks on my storage environment and is run from an AIX host. The script currently works great but I have been changing and updating bits of it to make it easier for my lesser colleagues to understand :p However now with the updates I have made I... (1 Reply)
Discussion started by: colinwilson1303
1 Replies

3. UNIX for Dummies Questions & Answers

Make a script accessible from any directory

I wrote a small fortran program that I want to control with a bash script. The bash script builds a parameter file that is used by the fortran program. I want to make it so I can access the script from any directory on my computer. How do I do that? Or what key words should I search for to find... (1 Reply)
Discussion started by: C_James
1 Replies

4. Shell Programming and Scripting

Shell script for a writing the directory structure to a file

Hi All, I am new user of shell scripting has come up with a problem. that I have a directory structure like : Home | |--------A | |----trunk | |-------A_0_1/ | | | |-------A_0_2/ | |--------B | ... (6 Replies)
Discussion started by: bhaskar_m
6 Replies

5. Shell Programming and Scripting

Script to remove all empty files within the directory structure?

Hi I need to write a shell script which basically searches for all the empty files within the directory structure, lists them before asking the user to confirm if they would like to delete them. If the user deletes the file then a notice would appear confirming the file is deleted. I've be... (5 Replies)
Discussion started by: cat123
5 Replies

6. Shell Programming and Scripting

make directory script

Hi, I try to write a script to create a new directory. #!/bin/bash echo "Please enter folder name (6 characters only) :" read foldername mkdir /home/user/$foldername $foldername >> /home/list/list.txt My question/situation: 1) how to ensure the folder name MUST BE 6 characters... (0 Replies)
Discussion started by: malaysoul
0 Replies

7. UNIX for Advanced & Expert Users

MV files from one directory structure(multiple level) to other directory structure

Hi, I am trying to write a script that will move all the files from source directory structure(multiple levels might exist) to destination directory structure. If a sub folder is source doesnot exist in destination then I have to skip and goto next level. I also need to delete the files in... (4 Replies)
Discussion started by: srmadab
4 Replies

8. UNIX for Dummies Questions & Answers

Copying a Directory Structure to a new structure

Hi all Is it possible to copy a structure of a directory only. e.g. I have a file with the following entries that is a result of a find :- /dir1/dir2/file.dbf /dir1/dir2/dir3/file1.dbf /dir1/file.dbf I want to copy these to a directory and keep the structure however starting at a new dir... (8 Replies)
Discussion started by: jhansrod
8 Replies

9. Post Here to Contact Site Administrators and Moderators

Make the SEARCH button REALLY BIG

Neo, Maybe it would be best to make the search button/option more visible? I know when I came here the first time, I didn't really notice that option. Just an idea. It appears that some people either don't see it.. or the obvious, don't want to use it, but I'd suggest that it's more of the... (8 Replies)
Discussion started by: ober5861
8 Replies
Login or Register to Ask a Question