Sponsored Content
Top Forums UNIX for Dummies Questions & Answers What option will use for deleting directory with all its contents? Post 302877351 by Don Cragun on Saturday 30th of November 2013 03:31:27 AM
Old 11-30-2013
I'm glad to hear that you solved your problem, but I'm confused by your comments.
The mkdir command (with or without the -p option) does not delete (or remove) directories.
This User Gave Thanks to Don Cragun For This Post:

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Query:just need to remove the contents of the file without deleting that

Hii, Please suggest me how can i only remove the contents of the file without deleting it. (3 Replies)
Discussion started by: namishtiwari
3 Replies

2. UNIX for Dummies Questions & Answers

Best way to list a directory's contents?

Hey guys! I'm so glad I found this site, I've had so many questions and have been left alone for roughly a year scanning man pages but It's just not quite cutting it for some things. So, I often like to list directories when browsing around my local machine, a friend's machine, or my web... (6 Replies)
Discussion started by: bbilheimer
6 Replies

3. UNIX for Dummies Questions & Answers

Deleting contents of a UNIX File

Hi ALL, Can anyone help me out. I have unix file, I need to delete the contents of the file. Can any one let me know the command to do this. The file has to be there, but the contents should be deleted. thanks Manas (6 Replies)
Discussion started by: manas6
6 Replies

4. Solaris

Directory should not be deleted, But the contents can be

Hi Guys, I have an user's home directory set to /home/A And A contains the following directories B & C Is there some way in solaris by which i can prevent the directories B and C from getting deleted by the user but the contents of the directories B & C can be deleted ? Also i have... (2 Replies)
Discussion started by: localhost
2 Replies

5. Shell Programming and Scripting

Deleting the file only to all the directory and sub directory

I need the unix command or shell script to delete all the file in current directory and sub directory. (7 Replies)
Discussion started by: kingganesh04
7 Replies

6. Shell Programming and Scripting

Deleting the contents of a folder older than X hours

Every day a new .zip file is uploaded to a folder and at mid-night the zip file is to be extracted into a /data/ folder, inside a date-named folder. # This should extract the contents of a zip file into the /data/ folder into a date based folder /usr/bin/unzip -a -o... (15 Replies)
Discussion started by: worchyld
15 Replies

7. Shell Programming and Scripting

Remove contents of directory, but not directory

What's the best way to delete everything in a directory, but not the directory itself, without using shell wildcards? (9 Replies)
Discussion started by: pdc
9 Replies

8. UNIX for Dummies Questions & Answers

Script For Deleting Contents of "Live" Log File

In our shop, we have a situation where a log file from our interface engine software has begun maxing out in file size (reaching the 32-bit "2147483647" limit). Currently, the only way to rectify this is to stop the interface and restart it, which generates a new log. Easy enough, but the... (6 Replies)
Discussion started by: rjhjr64
6 Replies

9. Shell Programming and Scripting

How to clear contents of a file without deleting it.

Hi, I have a script which will use an input.txt file as an input file. I am providing data to this input file in the script and once the script is executed, I want to clear all the contents of this file as during the second time use of this script, I'll be appending the data in this input... (5 Replies)
Discussion started by: pat_pramod
5 Replies

10. UNIX for Dummies Questions & Answers

Deleting a directory and zipping another directory

Hi Folks, I have a directory in unix that is /usr/local/pos contain the folowing directoreis ..that is dir1 dir2 dir3 now I want to delete only dir2 please advise how to remove the directory dir 2 ..that is rm command and how to use it , and second if I want to zip the dir3 please... (1 Reply)
Discussion started by: punpun66
1 Replies
mkdir(1)							   User Commands							  mkdir(1)

mkdir - make directories SYNOPSIS
/usr/bin/mkdir /usr/bin/mkdir [-m mode] [-p] dir... ksh93 mkdir [-p] [-m mode] dir... DESCRIPTION
/usr/bin/mkdir The mkdir command creates the named directories in mode 777 (possibly altered by the file mode creation mask umask(1)). Standard entries in a directory (for instance, the files ".", for the directory itself, and "..", for its parent) are made automatically. mkdir cannot create these entries by name. Creation of a directory requires write permission in the parent directory. The owner-ID and group-ID of the new directories are set to the process's effective user-ID and group-ID, respectively. mkdir calls the mkdir(2) system call. setgid and mkdir To change the setgid bit on a newly created directory, you must use chmod g+s or chmod g-s after executing mkdir. The setgid bit setting is inherited from the parent directory. ksh93 The mkdir built-in in ksh93 is associated with the /bin and /usr/bin paths. It is invoked when mkdir is executed without a pathname prefix and the pathname search finds a /bin/mkdir or /usr/bin/mkdir executable. mkdir creates one or more directories. By default, the mode of created directories is a=rwx minus the bits set in umask(1). OPTIONS
/usr/bin/mkdir The following options are supported by /usr/bin/mkdir: -m mode This option allows users to specify the mode to be used for new directories. Choices for modes can be found in chmod(1). -p With this option, mkdir creates dir by creating all the non-existing parent directories first. The mode given to intermediate directories is 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). ksh93 The following options are supported by the mkdir built-in in ksh93: -m mode Set the mode of created directories to mode. mode is symbolic or octal mode as in chmod(1). Relative modes assume an initial --mode=mode mode of a=rwx. -p Create any missing intermediate pathname components. For each dir operand that does not name an existing directory, effects --parents 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 is ignored without error. OPERANDS
The following operand is supported: dir A path name of a directory to be created. USAGE
See largefile(5) for the description of the behavior of mkdir when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). EXAMPLES
Example 1 Using mkdir The following example: example% mkdir -p ltr/jd/jan creates the subdirectory structure ltr/jd/jan. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of mkdir: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. EXIT STATUS
The following exit values are 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. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: /usr/bin/mkdir +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |Standard |See standards(5). | +-----------------------------+-----------------------------+ ksh93 +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |See below. | +-----------------------------+-----------------------------+ |Standard |See standards(5). | +-----------------------------+-----------------------------+ The ksh93 built-in binding to /bin and /usr/bin is Volatile. The built-in interfaces are Uncommitted. SEE ALSO
chmod(1), ksh93(1), rm(1), sh(1), umask(1), Intro(2), mkdir(2), attributes(5), environ(5), largefile(5), standards(5) SunOS 5.11 2 Nov 2007 mkdir(1)

Featured Tech Videos

All times are GMT -4. The time now is 09:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy