Sponsored Content
Top Forums Shell Programming and Scripting how to delete/remove directory in fastest way Post 101325 by getdpg on Tuesday 7th of March 2006 08:18:54 AM
Old 03-07-2006
how to delete/remove directory in fastest way

hello

i need help to remove directory . The directory is not empty ., it contains
several sub directories and files inside that..

total number of files in one directory is 12,24,446 .

rm -rf doesnt work . it is prompting for every file ..

i want to delete without prompting and fast way..

directory name is
2005-12-27
inside that
so different directories arethee

rm -rf 2005-12-27 .. ( it didnt work

pls suggest me .. or another fast way to delete the directory
 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

fastest way to remove duplicates.

I have searched the FAQ - by using sort, duplicates, etc.... but I didn't get any articles or results on it. Currently, I am using: sort -u file1 > file2 to remove duplicates. For a file size of 1giga byte approx. time taken to remove duplicates is 1hr 21 mins. Is there any other faster way... (15 Replies)
Discussion started by: radhika
15 Replies

3. Shell Programming and Scripting

delete two patterns and remove one pattern

Friends, I have .txt file with following format. START ABC|Prashant1|Patel1 ABC|Prashant2|Patel2 ABC|Prashant1|Patel1 ABC|Prashant2|Patel2 END I would like to do: 1) Delete line with START 2) Delete line with END 3) Remove ABC| 4) Delete duplicate records The following command... (7 Replies)
Discussion started by: ppat7046
7 Replies

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

5. Shell Programming and Scripting

Fastest way to delete line

I have a 5 GB text file(log/debug) I want to delete all lines containing 'TRACE' Command used sed -i '/TRACE/d' mylog.txt Is there any other fastest way to do this? (1 Reply)
Discussion started by: johnbach
1 Replies

6. AIX

Fastest way to count big amount of files in sub directory

Hi, what happened is we want to count all the files in a directory and inside this directory got many folders and so take long time to count it. Already run for about few minutes but still not done. The command we use to count is find . -type f | wc -l Just wondering if there is any other... (9 Replies)
Discussion started by: ngaisteve1
9 Replies

7. Shell Programming and Scripting

Fastest way to delete duplicates from a large filelist.....

OK I have two filelists...... The first is formatted like this.... /path/to/the/actual/file/location/filename.jpg and has up to a million records The second list shows filename.jpg where there is more then on instance. and has maybe up to 65,000 records I want to copy files... (4 Replies)
Discussion started by: Bashingaway
4 Replies

8. Shell Programming and Scripting

delete from line and remove duplicates

My Input.....file1 ABCDE4435 Connected to 107.71.136.122 (SubNetwork=ONRM_RootMo_R SubNetwork=XYVLTN29CRBR99 MeContext=ABCDE4435 ManagedElement=1) ABCDE4478 Connected to 166.208.30.57 (SubNetwork=ONRM_RootMo_R SubNetwork=KLFMTN29CR0R04 MeContext=ABCDE4478 ManagedElement=1) ABCDE4478... (5 Replies)
Discussion started by: pareshkp
5 Replies

9. Shell Programming and Scripting

Fastest way calculating directory

Hi expert, Is there any fastest way to calculate recursive directory, and I have total 600 directories have 100000 files and 10 directory approximately 9000000 - 10000000 each files per directory. currently using this command "du -k --max-depth=0" to get the size but very slow it take 24 hours... (9 Replies)
Discussion started by: rufino
9 Replies

10. 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
rm(1)							      General Commands Manual							     rm(1)

Name
       rm, rmdir - remove (unlink) files or directories

Syntax
       rm [-f] [-r] [-i] [-] file-or-directory-name...
       rmdir directory-name...

Description
       The command removes the entries for one or more files from a directory.	If there are no links to the file then the file is destroyed.  For
       further information, see

       The command removes entries for the named directories, which must be empty.  If they are not empty, the directories remain, and displays an
       error message (see EXAMPLES).

       To  remove  a file, you must have write permission in its directory, but you do not need read or write permission on the file itself.  When
       you are using from a terminal, and you do not have write permission on the file, the command asks for confirmation  before  destroying  the
       file.

       If  input  is redirected from the standard input device (your terminal), then checks to ensure that input is not coming from your terminal.
       If not, sets the -f option, which overrides the file protection, and removes the files silently, regardless of what you have  specified	in
       the file redirected as input to See EXAMPLES.

Options
       -    Specifies that the named files have names beginning with a minus (for example ).

       -f   Forces the removal of file or directory without first requesting confirmation.  Only system or usage messages are displayed.

       -i   Prompts  for yes or no response before removing each entry.  Does not ask when combined with the -f option.  If you type a y, followed
	    by any combination of characters, a yes response is assumed.

       -r   Recursively removes all entries from the specified directory and, then, removes the entry for that directory from  its  parent  direc-
	    tory.

Examples
       The following example shows how to remove a file in your current working directory.
       rm myfile
       This example shows use of the null option to remove a file beginning with a minus sign.
       rm - -gorp
       This example shows how a confirmation is requested for removal of a file for which you do not have write permission.
       rm testfile
       rm: override protection 400 for testfile? y
       This  example  shows  how  the combination of -i and -r options lets you examine all the files in a directory before removing them.  In the
       example, mydirectory is a subdirectory of the current working directory.  Note that the last question requests confirmation before removing
       the  directory  itself.	 Although  the user types ``y'', requesting removal of the directory, the command does not allow this, because the
       directory is not empty; the user typed ``n'' to the question about the file file2 , so file2 was not removed.
       rm -ir mydirectory
       rm: remove mydirectory/file1? y
       rm: remove mydirectory/file2? n
	     .
	     .
	     .
       rm: remove mydirectory? y
       rm: mydirectory: Directory not empty
       This example illustrates that overrides file protection when input is redirected from the standard input device.  The user creates  a  file
       named ``alfie'', with a read-only file protection.  The user then creates a file named ``ans'' to contain the character ``n''.  The command
       following destroys the file ``alfie'', even though the redirected input file requested no deletion.
       cat > alfie
       hello
       ^d
       chmod 444 alfie
       cat > ans
       n
       ^d
       rm < ans alfie

See Also
       unlink(2)

																	     rm(1)
All times are GMT -4. The time now is 07:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy