Sponsored Content
Homework and Emergencies Homework & Coursework Questions Single command to delete a directory Post 302361636 by Scott on Tuesday 13th of October 2009 05:58:46 PM
Old 10-13-2009
Going back to your original question, an absolute path is one which starts with / (the root directory)

If your directory is /home/paul and john is ../john from where you are, then john is in /home/paul/../john.

Code:
/home/paul # pwd
/home/paul
/home/paul # cd /home/paul/../john
/home/john # pwd
/home/john

.. means parent, therefore john is in the parent of paul, which is /home

i.e /home/john

It's probably best if you delete john from /home instead of /home/john

Code:
cd /home
rm -rf john

or as you have to move up one (..)

Code:
cd ..
rm -rf john

If we decide to start handing out medals for who can explain things stupidly, I must be a contender!
 

10 More Discussions You Might Find Interesting

1. Linux

command in linux to delete a directory

hi all, can anybody tell me command(in linux) to delete a directory which have other directories & files in it. its urgent thanks vikas (2 Replies)
Discussion started by: guptavikas1
2 Replies

2. Solaris

How to delete Directory and inside files using Find command

I am using the following Command to delete Directory with contents. But this command is deleting inside files only not directories. is there any change need in my command? find -type f -mtime +3 -exec rm -r {} \; Thanks (3 Replies)
Discussion started by: bmkreddy
3 Replies

3. Shell Programming and Scripting

shell script which will delete every thing under a directory except a single sub dire

write a shell script which will delete every thing under a directory except a single sub directory (2 Replies)
Discussion started by: alokjyotibal
2 Replies

4. UNIX for Dummies Questions & Answers

single line command to delete a 6 months old file

i had this scenario where i need to delete a file that is 6 months old which is no longer needed. basically the filename is in the format of PCARDDAILYmmddyyyy.txt where the mm is the month, dd is the day, and yyyy is the year. e.g. PCARDDAILY05262009.txt PCARDDAILY05252009.txt ... (6 Replies)
Discussion started by: wtolentino
6 Replies

5. Shell Programming and Scripting

Delete empty files from a directory entered in command prompt

My code to "Delete empty files from a directory entered in command promt" #/bin/sh echo "Enter directory" read gh for file in `ls $gh` do # to get the size of file a=$( ls -l file | awk ' {print $7} '); echo $a if then echo "removing file " rm file fi done (6 Replies)
Discussion started by: adirajup
6 Replies

6. Shell Programming and Scripting

Change to directory and search some file in that directory in single command

I am trying to do the following task : export ENV=aaa export ENV_PATH=$(cd /apps | ls | grep $ENV) However, it's not working. What's the way to change to directory and search some file in that directory in single command Please help. (2 Replies)
Discussion started by: saurau
2 Replies

7. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

8. Shell Programming and Scripting

Command to delete half of files in directory.

Hello Friends, I have directory called /tmp. which stores the log files. Whenever it becomes full, i want to delete half of files from all log files. even after deleting the files, if space is more than 90% then it should delete rest of half files. While deleting files, older files... (7 Replies)
Discussion started by: Nakul_sh
7 Replies

9. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

10. Shell Programming and Scripting

Move multiple files to different directory using a single command

I have multiple files test1, test2, test3 etc. I want to move to a different directory with ABC_ prefixed to every file and and current dat time as postfix using a single command. (I will be using this is sftp with ! (command for local server). I have tried the following but it gives error ... (5 Replies)
Discussion started by: Soham
5 Replies
UNAFS(8)                                                      System Manager's Manual                                                     UNAFS(8)

NAME
unafs - script to warn users about their weak passwords SYNOPSIS
unafs password-files cell-name DESCRIPTION
This manual page documents briefly the unafs command, which is part of the john package. This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page. john, better known as John the Ripper, is a tool to find weak passwords of users in a server. The unafs tool gets password hashes out of the binary AFS database, and produces a file usable by John. SEE ALSO
john(8), mailer(8), unique(8), unshadow(8). The programs are documented fully by John's documentation, which should be available in /usr/share/doc/john or other location, depending on your system. AUTHOR
This manual page was written by Jordi Mallach <jordi@debian.org>, for the Debian GNU/Linux system (but may be used by others). John the Ripper and mailer were written by Solar Designer <solar@openwall.com>. The complete list of contributors can be found in the CRED- ITS file in the documentation directory. john June 03, 2004 UNAFS(8)
All times are GMT -4. The time now is 08:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy