Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Mkdir a/b/c # where a/b does not exists. is it possible to create it ? Post 302823661 by in2nix4life on Wednesday 19th of June 2013 03:42:16 PM
Old 06-19-2013
Code:
rm -rvf a
removed 'a/file1'
removed 'a/b/file2'
removed 'a/b/c/file3'
removed directory: 'a/b/c'
removed directory: 'a/b'
removed directory: 'a'

 

9 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

mkdir: cannot create directory

Hi, I have network mount on two servers. One server I can create any directories without any issues, other server with the similar mount, I am not able to create directories starting with number! Creation, name start with a number: $ mkdir 1212 mkdir: cannot create directory `1212': No such... (12 Replies)
Discussion started by: ./hari.sh
12 Replies

2. Shell Programming and Scripting

Newbie.. Find if a file exists and open, if not create the desired file..

Hey all, I'm brand new to script writing, I'm wanting to make a script that will ask for a file and then retrieve that file if it exists, and if it doesn't exist, create the file with the desired name, and I'm completely stuck.. so far.. #! bin/bash echo "Enter desired file" read "$file" if ... (5 Replies)
Discussion started by: Byrang
5 Replies

3. Shell Programming and Scripting

[Solved] how to create multiple directory in one mkdir command

Hi, Unix Gurus, - I have a simple question, I need create multiple directory. I use mkdir {dir1, dir2, dir3) I got one directory as {dir1, dir2, dir3} I searched @ google, I got answer as above code.:wall::confused: Anybody has any idea Thanks in advance ---------- Post updated... (3 Replies)
Discussion started by: ken002
3 Replies

4. UNIX for Dummies Questions & Answers

mkdir: cannot create directory `/builds/somedir/': Permission denied

Hi, I am trying to run a shell script which contains an mkdir command as part of the execution. The script fails with the following error: mkdir: cannot create directory `/builds/somedir/': Permission denied The user running the script is 'harry' and belongs to group 'school'.... (5 Replies)
Discussion started by: Technext
5 Replies

5. Shell Programming and Scripting

how to check if a directory exists or not.if not need to create it

Hi, I am using solaris 10 OS and bash shell.just checking for small code snippet which follows below. /export/home/vomappservers/spa/common/5.0 /export/home/vomappservers/spa/common/scripts /export/home/vomappservers/spa/tools /export/home/vomappservers/spa/scm5.0/SCCS... (5 Replies)
Discussion started by: muraliinfy04
5 Replies

6. Red Hat

Mkdir: cannot create directory `/home/phpmy/html': Permission denied centos

for incompatibility installation problems, I've decided to reinstall Centos 6.3 as can be seem from the df output, I've partitioned both / and and /home directories $ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda8 12G 5.3G 6.5G 45% / tmpfs ... (2 Replies)
Discussion started by: jediwannabe
2 Replies

7. Shell Programming and Scripting

See if file exists and if not create it

Hi, I am using an expect script to roll out an ssh key to multiple servers. I have a problem as on some of them the authorized_keys file exists and on some it doesn't. Where it exists I need to >> the key in and where it doesn't I need to create the file then sftp the file over. So I need some... (2 Replies)
Discussion started by: Grueben
2 Replies

8. Shell Programming and Scripting

Copy of "How to create a long list of directories with mkdir?"

To bakunin and corona688: My result when text in file is ms_ww_546 ms_rrL_99999 ms_nnn_67_756675 is https://www.unix.com/C:\Users\Fejoz\Desktop\ttt.jpg I hope you can see the picture. There is like a "whitespace character" after 2 of the 3 created directories. ---------- Post... (0 Replies)
Discussion started by: setub
0 Replies

9. Shell Programming and Scripting

How to create a long list of directories with mkdir?

Hi... Thanks to read this... I want to use mkdir to create many directories listed in a text file, let's say. How do I do this? Sorry for this maybe very basic question :) (13 Replies)
Discussion started by: setub
13 Replies
MKDIR(1P)						     POSIX Programmer's Manual							 MKDIR(1P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
mkdir - make directories SYNOPSIS
mkdir [-p][-m mode] dir... DESCRIPTION
The mkdir utility shall create the directories specified by the operands, in the order specified. For each dir operand, the mkdir utility shall perform actions equivalent to the mkdir() function defined in the System Interfaces volume of IEEE Std 1003.1-2001, called with the following arguments: 1. The dir operand is used as the path argument. 2. The value of the bitwise-inclusive OR of S_IRWXU, S_IRWXG, and S_IRWXO is used as the mode argument. (If the -m option is specified, the mode option-argument overrides this default.) OPTIONS
The mkdir utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines. The following options shall be supported: -m mode Set the file permission bits of the newly-created directory to the specified mode value. The mode option-argument shall be the same as the mode operand defined for the chmod utility. In the symbolic_mode strings, the op characters '+' and '-' shall be interpreted relative to an assumed initial mode of a= rwx; '+' shall add permissions to the default mode, '-' shall delete permissions from the default mode. -p Create any missing intermediate pathname components. For each dir operand that does not name an existing directory, effects equivalent to those caused by the following command shall occur: mkdir -p -m $(umask -S),u+wx $(dirname dir) && mkdir [-m mode] dir where the -m mode option represents that option supplied to the original invocation of mkdir, if any. Each dir operand that names an existing directory shall be ignored without error. OPERANDS
The following operand shall be supported: dir A pathname of a directory to be created. STDIN
Not used. INPUT FILES
None. ENVIRONMENT VARIABLES
The following environment variables shall affect the execution of mkdir: LANG Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of IEEE Std 1003.1-2001, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments). LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES . ASYNCHRONOUS EVENTS
Default. STDOUT
Not used. STDERR
The standard error shall be used only for diagnostic messages. OUTPUT FILES
None. EXTENDED DESCRIPTION
None. EXIT STATUS
The following exit values shall be returned: 0 All the specified directories were created successfully or the -p option was specified and all the specified directories now exist. >0 An error occurred. CONSEQUENCES OF ERRORS
Default. The following sections are informative. APPLICATION USAGE
The default file mode for directories is a= rwx (777 on most systems) with selected permissions removed in accordance with the file mode creation mask. For intermediate pathname components created by mkdir, the mode is the default modified by u+ wx so that the subdirectories can always be created regardless of the file mode creation mask; if different ultimate permissions are desired for the intermediate direc- tories, they can be changed afterwards with chmod. Note that some of the requested directories may have been created even if an error occurs. EXAMPLES
None. RATIONALE
The System V -m option was included to control the file mode. The System V -p option was included to create any needed intermediate directories and to complement the functionality provided by rmdir for removing directories in the path prefix as they become empty. Because no error is produced if any path component already exists, the -p option is also useful to ensure that a particular directory exists. The functionality of mkdir is described substantially through a reference to the mkdir() function in the System Interfaces volume of IEEE Std 1003.1-2001. For example, by default, the mode of the directory is affected by the file mode creation mask in accordance with the specified behavior of the mkdir() function. In this way, there is less duplication of effort required for describing details of the direc- tory creation. FUTURE DIRECTIONS
None. SEE ALSO
chmod(), rm, rmdir(), umask(), the System Interfaces volume of IEEE Std 1003.1-2001, mkdir() COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 MKDIR(1P)
All times are GMT -4. The time now is 11:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy