Sponsored Content
Full Discussion: rmdir a non-empty directory.
Top Forums UNIX for Dummies Questions & Answers rmdir a non-empty directory. Post 32936 by TioTony on Tuesday 10th of December 2002 10:56:37 PM
Old 12-10-2002
You could use rm -R instead. This will remove the directory as well as any files and subdirectories as long as they are not in use. Be carefull though, make sure you specify the correct directory or you can remove a lot of stuff quickly.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Setting the right directory as non-empty

Hi guys, I've been trying to get this part of my script to work for ages and now it's getting me annoyed!! So i thought a fresh group of eyes could see where i'm going wrong! The idea is getting a directory and all its files moved to a temp folder, but similar to the rm -ir command where it... (0 Replies)
Discussion started by: olimiles
0 Replies

2. UNIX for Dummies Questions & Answers

-r paramater with chown and rmdir

If I am root user, and trying to chown everything in a directory and it's subdirectories (e.g. httpdocs and everything inside that directory, including it's sub directories), how would I do that? I tried it with -r but it didnt seem to work...can someone help with the correct syntax? Also, if I... (3 Replies)
Discussion started by: Eman619
3 Replies

3. Shell Programming and Scripting

How to empty all files in a directory

Hi all, Can you tell me how to empty all files in a directory with a "find" command? It does not seem to work the way I try it: # ls -l *.dat -rw-r--r-- 1 root root 7 Jul 20 20:51 la2.dat -rw-r--r-- 1 root root 4 Jul 20 20:51 la.dat # find... (9 Replies)
Discussion started by: majormark
9 Replies

4. Shell Programming and Scripting

How do I tell if a directory is empty?

To see if a directory is has anything in it, I do this: if ; then # do something fi But surely there is a more easy-to-read and elegant way. Isn't there? (6 Replies)
Discussion started by: KenJackson
6 Replies

5. UNIX for Dummies Questions & Answers

Quick question...rmdir -l

Hello, We use a very basic version of unix via putty and are not experts by any means. We accidentally submitted the statement: "mkdir -l" ("dash-letter L) and a new directory was created. Putty/UNIX will now not recognize the statement "rmdir -l". When we run a "ls -l" command, it shows... (3 Replies)
Discussion started by: UDcc123
3 Replies

6. Shell Programming and Scripting

remove empty directory

Hi, I need to delete an empty directory in a temp directory except "dir5" (keep everything that is not empty). Plese advise. Here is an example of my directory. /dir/temp/ dir1 - delete if this is empty dir2 - delete if this is empty dir3 - delete if this is empty dir4 - delete if this... (7 Replies)
Discussion started by: sirrtuan
7 Replies

7. SCO

Deleting a directory that is not empty

I know someone will probably laugh at this question, I probably knew the answer many years ago when I was doing this full time but here goes..... I have a directory that has many files and sub-directories in it, RMDIR will not delete a directory that is not empty so what is the command to... (1 Reply)
Discussion started by: moondogi
1 Replies

8. Shell Programming and Scripting

Check whether a Directory is empty or not

1.pls tell me the command for checking whether a given directory is empty or not . 2. can i check what is the last copied item in a directory . and i yes , i want to move that last copied item in another directory . pls help me with shell code for these two tasks thanks (1 Reply)
Discussion started by: upvan111
1 Replies

9. Homework & Coursework Questions

Check whether a Directory is empty or not

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 1.pls tell me the command for checking whether a given directory is empty or not . 2. can i check what is the... (1 Reply)
Discussion started by: upvan111
1 Replies

10. Programming

Perl - How to empty a directory?

Hi Guys, i'm writing a perl script which whenever runs, should empty 3 pre-decided directories as first step and then the script has the logic to parse some other directories and copy the files inside those directories into these 3 directories. I've the logic already developed, just need to... (2 Replies)
Discussion started by: jhamaks
2 Replies
nisrmdir(1)							   User Commands						       nisrmdir(1)

NAME
nisrmdir - remove NIS+ directories SYNOPSIS
nisrmdir [-if] [-s hostname] dirname DESCRIPTION
nisrmdir deletes existing NIS+ subdirectories. It can remove a directory outright, or simply remove replicas from serving a directory. This command modifies the object that describes the directory dirname, and then notifies each replica to remove the directory named dirname. If the notification of any of the affected replicas fails, the directory object is returned to its original state unless the -f option is present. This command will fail if the NIS+ master server is not running. OPTIONS
The following options are supported: -i Interactive mode. Like the system rm(1) command the nisrmdir command will ask for confirmation prior to removing a direc- tory. If the name specified by dirname is a non-fully qualified name this option is forced on. This prevents the removal of unexpected directories. -f Force the command to succeed even though it may not be able to contact the affected replicas. This option should be used when a replica is known to be down and will not be able to respond to the removal notification. When the replica is finally rebooted it will read the updated directory object, note that it is no longer a replica for that directory, and stop responding to lookups on that directory. Cleanup of the files that held the now removed directory can be accomplished manu- ally by removing the appropriate files in the /var/nis directory. See nisfiles(4) for more information. -s hostname Specify that the host hostname should be removed as a replica for the directory named dirname. If this option is not present all replicas and the master server for a directory are removed and the directory is removed from the namespace. Special per-server and per-directory access restrictions may apply when this command updates the serving lists of the affected NIS+ servers. For more information, see nisopaccess(1). OPERANDS
The following operand is supported: dirname An existing NIS+ directory. EXAMPLES
Example 1: Using the nisrmdir Command To remove a directory bar under the foo.com. domain, one would use the command: example% nisrmdir bar.foo.com. To remove a replica that is serving directory bar.foo.com. one would use the command: example% nisrmdir -s replica.foo.com. bar.foo.com. To force the removal of directory bar.foo.com. from the namespace, one would use the command: example% nisrmdir -f bar.foo.com. ENVIRONMENT VARIABLES
NIS_PATH If this variable is set, and the NIS+ directory name is not fully qualified, each directory specified will be searched until the directory is found. See nisdefaults(1). EXIT STATUS
The following exit values are returned: 0 Successful operation. 1 Operation failed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWnisu | +-----------------------------+-----------------------------+ SEE ALSO
nis+(1), nisdefaults(1), nisopaccess(1),nisrm(1), nisfiles(4), attributes(5) NOTES
NIS+ might not be supported in future releases of the SolarisTM Operating Environment. Tools to aid the migration from NIS+ to LDAP are available in the Solaris 9 operating environment. For more information, visit http://www.sun.com/directory/nisplus/transition.html. SunOS 5.10 10 Dec 2001 nisrmdir(1)
All times are GMT -4. The time now is 06:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy