Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Remove all things from directory Post 302606311 by Scrutinizer on Saturday 10th of March 2012 02:37:34 PM
Old 03-10-2012
Quote:
Originally Posted by gull04
Just use the "rm" command carefully.

From with the directory that you wish to delete the contents of - eg

Code:
cd /home/my_dir_to_delete
rm -rf *

You'll have to make sure that you have the correct permissions to delete everything.

Go Carefully if you are new to this as mistakes can be hard to rectify - and always ensure that you have a backup even if you think you'll never need the data againSmilie
Good advice and a case in point, suppose the first of the two commands (the cd command) fails and you are either too quick with the second command or you are executing the two together (from the command line or from a script) then you end up deleting the current directory and everything underneath Smilie

So use a long pause after the first command and type pwd and ls -al etcetera to verify that you are in the proper directory and have proper rights.

Last edited by Scrutinizer; 03-10-2012 at 03:56 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

a program which linux things is a directory??

Hi, Well I finally got around to installing linux , the install went fine. I have just tried on to install some software.It gunziped and untared fine. It even complied fine. However when I try to run the program. I get the message "bash: is a directory". I have tried changing the permission on... (4 Replies)
Discussion started by: john_bir
4 Replies

2. UNIX for Dummies Questions & Answers

smitty, remove user, remove directory as well..

hi, i am on aix. i used smitty to remove a user.. but then found that its directory still exists.... so i have to remove the directory manually... am i doing it the right way? (2 Replies)
Discussion started by: yls177
2 Replies

3. AIX

remove hardlink directory

I have to move a lpar from one 671 to another (aix 5.2 ML 07) when I run mksysb, It alway hangs with "archieving file list" I've tried to exlude every directory, but still not working the only thing that can be a problem, is a hardlink directory normally it should not be possible to... (4 Replies)
Discussion started by: funksen
4 Replies

4. Solaris

Can't remove a directory

Hello, somehow a directory called -r was created on one of my servers and I can't remove is using either rm or rmdir. Is there a way to remove this directory? Thank you. -David (2 Replies)
Discussion started by: dkranes
2 Replies

5. 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

6. Shell Programming and Scripting

Remove Directory

By Mistake i created a directory named "-lrt" in one of my working directories and now i am not able to delete it , please suggest hw to delete this directory now ? Thanks in advance. (1 Reply)
Discussion started by: neeraj617
1 Replies

7. HP-UX

Directory can't remove!

Hello my friends, I have a directory called log_old when I try to delete it, it tells me no such file or directory. Then I tried to run this command: ls -lb It tells me the directory name, it is: log_old1\177 !! I tried to remove it using inode, using this... (4 Replies)
Discussion started by: Mohannad
4 Replies

8. UNIX for Dummies Questions & Answers

How to remove directory of a particular user?

How to remove directory of a particular user (1 Reply)
Discussion started by: pspriyanka
1 Replies

9. Shell Programming and Scripting

Trying to make a bash script that goes through directory files and changes things

I'm trying to write a script in a directory that goes through the column the user specifies of 4 files that are inside the directory and calculates the min and the max values. This means that if the user specifies column 5, the script will go through column 5 of all 4 files and all that should give... (2 Replies)
Discussion started by: Eric1
2 Replies
asadmin-delete-domain(1AS)					   User Commands					asadmin-delete-domain(1AS)

NAME
asadmin-delete-domain, delete-domain - deletes the givendomain SYNOPSIS
delete-domain [--terse=false] [--echo=false] [--domaindir install_dir/domains] domain_name delete-domain deletes the specified domain. The domain must already exist and must be stopped. This command is supported in local mode only. OPTIONS
--domaindir directory where the domain is to be deleted. If specified, path must be accessible in the filesystem. If not speci- fied, the domain in the default install_dir/domains directory is deleted. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. OPERANDS
domain_name name of the domain. Must be a unique name. Example 1: Using delete-domain asadmin> delete-domain sampleDomain deleted domain sampleDomain successfully Where: the sampleDomain domain is deleted. EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-create-domain(1AS), asadmin-start-domain(1AS), asadmin-stop-domain(1AS), asadmin-list-domains(1AS) J2EE 1.4 SDK March 2004 asadmin-delete-domain(1AS)
All times are GMT -4. The time now is 10:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy