Sponsored Content
Top Forums Shell Programming and Scripting Automating creation of directories Post 302597669 by chihung on Saturday 11th of February 2012 10:14:31 AM
Old 02-11-2012
you can use shell braces to let shell to expand all the arguments. suppose you want to create w1/t1 w1/t2 w2/t1 w2/t2 w3/t1 w3/t3 directories

Code:
mkdir -p {w1,w2,w3}/{t1,t2}

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Automating creation of sub-domains???

Edit, Sorry realised that muxtape.com is probably not creating a sub-domain for every accout but more than likely using a wildcard in the apache config and then using php/asp/java or similar to look at the url and point it in the right direction. So youraccount.muxtape.com maps to... (0 Replies)
Discussion started by: elduderino
0 Replies

2. Shell Programming and Scripting

Script for parsing directories one level and finding directories older than n days

Hello all, Here's the deal...I have one directory with many subdirs and files. What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file. A script for... (5 Replies)
Discussion started by: ejianu
5 Replies

3. Shell Programming and Scripting

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... (4 Replies)
Discussion started by: rajeshnatarajan
4 Replies

4. UNIX for Dummies Questions & Answers

List directories with given string, sort by creation date

It is for HP-Unix B.11.31. Requirement: 1. List the directories, which directories name has given particular string. Example: Directories with name "Build" 2. On the output of 1. list the directories by creation date as sort order. I tried with; find . -type d -name "Build*" ... (3 Replies)
Discussion started by: Siva SQL
3 Replies

5. HP-UX

Symbolic link creation between 2 directories on different machines

I am trying to link 2 directories using: ln -s /net/<hostname>/srcdir/ /net/<desthostname>/dstdir/ I get the following error: ln: /net/<desthostname>/dstdir: Function is not available What is it that i am trying to do wrongly in the above operation? Please use next time code tags (3 Replies)
Discussion started by: Amit Kulkarni
3 Replies

6. Shell Programming and Scripting

How to list all the files, directories and sub-directories in the current path except one directory?

Can anyone come up with a unix command that lists all the files, directories and sub-directories in the current directory except a folder called log.? Thank you in advance. (7 Replies)
Discussion started by: Manjunath B
7 Replies

7. UNIX for Dummies Questions & Answers

List the directories, having given pattern in the directories name, sorted by creation date

It is for HP-Unix B.11.31. Requirement: 1. List the directories, having given pattern in the directories name, sorted by creation date. Example: Directories with name "pkg32*" or "pkg33*" 2. On the output of 1. list the directories by creation date as sort order, with creation date... (2 Replies)
Discussion started by: Siva SQL
2 Replies

8. Shell Programming and Scripting

[Solved] Creation of directories

i am having trouble creating a directory with last months date as the folder name. what i am using is echo `date +%b%y` which gives Mar14 as the result but i want to get Feb14 as the result.:wall: (6 Replies)
Discussion started by: simkazw
6 Replies

9. Solaris

Giving read write permission to user for specific directories and sub directories.

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. This is for Solaris. Please help. (1 Reply)
Discussion started by: blinkingdan
1 Replies
mkdir(1)						      General Commands Manual							  mkdir(1)

NAME
mkdir - Makes a directory SYNOPSIS
mkdir [-m mode] [-p] directory... STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: mkdir: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Sets the file permissions to mode, a symbolic mode string as defined for chmod, after creating the specified directory. The mode argument can be either an absolute mode string or a symbolic mode string as defined for chmod. See the chmod(1) reference page. In symbolic mode strings, the operation characters + and - are interpreted relative to an assumed initial mode of a=rwx, A + adds permissions to the default mode, whereas a - deletes permissions from the default mode. Creates intermediate directories as neces- sary; otherwise, the full path name prefix to directory must already exist. The user must have mkdir write permission in the parent directory. Each component of directory that does not name an existing directory is created with mode 777, modified by the current file mode creation mask (umask). The equivalent of chmod u+wx is performed on each component to ensure that mkdir can create lower directo- ries regardless of the setting of umask. Each component of directory that names an existing directory is ignored without error. If an intermediate path name component exists, but permissions are set to prevent writing or searching, mkdir fails and returns an error message. The mode argument does not apply to any intermediate directories created when the -p option is specified. OPERANDS
The path name of the directory to be created. DESCRIPTION
The mkdir command creates new directories with read, write, and execute permissions based upon the permissions established by the umask setting. [Tru64 UNIX] The mkdir command also creates the standard entries (dot) for the directory itself and (dot dot) for its parent. NOTES
Some of the requested directories may be created although an error occurs subsequent to the directory creation. If the directory specified by the -p option already exists, the command does not return an error status, in compliance with POSIX.2. [Tru64 UNIX] To make a new directory, you must have write permission in the parent directory. EXIT STATUS
The following exit values are returned: All requested directories were created, or the -p option was used and all of the requested directo- ries now exist. An error occurred. EXAMPLES
To create a new directory called test, enter: mkdir test To set file permissions for new directory test in absolute mode, enter: mkdir -m 444 test To set file permissions for new directory test in symbolic mode, enter: mkdir -m+rw test ENVIRONMENT VARIABLES
The following environment variables affect the execution of mkdir: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: chmod(1), rm(1), rmdir(1), Bourne shell sh(1b), POSIX shell sh(1p), umask(1) Functions: mkdir(2) Standards: standards(5) mkdir(1)
All times are GMT -4. The time now is 12:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy