Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to remove directory with subdirectories and files? Post 302118350 by the_learner on Monday 21st of May 2007 01:52:16 PM
Old 05-21-2007
I have a similar problem. I have a directory with *LOTS* of hidden files (beginning with a . )

In this case when I use rm -rf, I get the error:

rm: Unable to remove directory dir0: File exists

The thing is, I do not know where did all those files come from.. I think I did an nfs mount and something went wrong.. and these random files keep getting produced

-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsD355*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsD455*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsD845*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsD945*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsDA45*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsDB45*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsDC45*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsDD45*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsDE45*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsDF45*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsE055*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsE155*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsE255*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsE355*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsE455*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsE845*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsE945*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsEA45*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsEB45*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsEC45*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsED45*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsEE45*
-rwxrwxrwx 1 root engr 8192 May 5 20:35 .nfsEF45*


even in dir0, rm .nfs* does not work.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to Remove Ctrl M characters in files from directories and its subdirectories

Hi, How to recursively remove Ctrl M characters in files from a directory and its sub directory ? I know unix2dos command is there but to remove in bunch of files ... ? Thanks (7 Replies)
Discussion started by: skdp
7 Replies

2. Shell Programming and Scripting

search files in a directory and its subdirectories

Hello my friends, I need to write a simple shell bad file :D that search and delete a file it's name 'Microsoft.txt' in the current directory and its subdirectories? So can you help to guide me how i can write this shell, Just give me the beginning :o thank you. (1 Reply)
Discussion started by: Net-Man
1 Replies

3. Shell Programming and Scripting

Replace a string in all files under a directory and its subdirectories

Hello Friends, I've been trying to write a script which finds a string and change it with another string. For this i want to search all files (with its arguments) under a spesific directory and its subdirectories. For example lets assume i want to replace an IP= 192.168.0.4 with another... (4 Replies)
Discussion started by: EAGL€
4 Replies

4. Shell Programming and Scripting

Bash: Gzip files in Directory and itīs Subdirectories

Hello dear Community, I have a task to wrtie a script which will gzip not zipped files in a directory and itīs subdirectories. I succeeded in gzippung the directory but not the subdirectories: #/bin/bash #go to the directory where to zip cd $1 #Zip unzipped files for i in `ls | xargs... (2 Replies)
Discussion started by: JamesCarter
2 Replies

5. Shell Programming and Scripting

Find files only in current directory...not subdirectories

Hi, I have to find files only in the current directory...not in the sub directories. But when I use Find command ... it searches all the files in the current directory as well as in the subdirectories. I am using AIX-UNIX machine.Please help..I tried to use maxdepth..but it is not working in AIX. (2 Replies)
Discussion started by: vsachan
2 Replies

6. Shell Programming and Scripting

Remove files from subdirectories given a list of filenames

Dear all, I have a dir structure like main_dir At_nn Ag_js Nf_hc .... mcd32 mgd43... mcd32 mgd43... mcd32 mgd43... and each subdir (e.g. mcd32, mgd43) contains files. Now, i... (15 Replies)
Discussion started by: yogeshkumkar
15 Replies

7. Shell Programming and Scripting

Help on Backing up all the files in the subdirectories under a parent directory

Hi, I am not too familiar with Unix scripting but I have to write code to find all the files under all the sub directories under a parent directory of unix location and move them to the corresponding Windows location. For eg: I have \home\sreenu\Files\ Under neath this I have multiple sub... (3 Replies)
Discussion started by: raj.sreenu
3 Replies

8. Shell Programming and Scripting

List files with *.i extension in a directory and all its subdirectories + 30days old then remove

I need to write a script to : list files with *.i extension in a directory and all its subdirectories + 30days old, save it in a file and then remove (2 Replies)
Discussion started by: lena keung
2 Replies

9. UNIX for Dummies Questions & Answers

Remove all the subdirectories except latest 5 inside any given directory

I Want to remove all the sub-directories except latest five in any given TGTDIR. Is there a way to do so without making a cd to TGTDIR? I have tried the following but not worked. Thank you. rm -rf `ls -t $TGTDIR | awk 'NR>5'` (20 Replies)
Discussion started by: Devendra Hupri
20 Replies

10. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies
io_pipe(3)						     Library Functions Manual							io_pipe(3)

NAME
io_pipe - create a Unix pipe SYNTAX
#include <io.h> int io_pipe(int64 pfd[2]); DESCRIPTION
io_pipe creates a new UNIX ``pipe.'' The pipe can receive data and provide data; any bytes written to the pipe can then be read from the pipe in the same order. A pipe is typically stored in an 8192-byte memory buffer; the exact number depends on the UNIX kernel. Bytes are written to the end of the buffer and read from the beginning of the buffer. Once a byte has been read, it is eliminated from the buffer, making space for another byte to be written; readers cannot ``rewind'' a pipe to read old data. Once 8192 bytes have been written to the buffer, the pipe will not be ready for further writing until some of the bytes have been read. Once all the bytes written have been read, the pipe will not be ready for further reading until more bytes are written. io_pipe sets d[0] to the number of a new descriptor reading from the pipe, and sets d[1] to the number of a new descriptor writing to the pipe. It then returns 1 to indicate success. If something goes wrong, io_pipe returns 0, setting errno to indicate the error; in this case it frees any memory that it allocated for the new pipe, and it leaves d alone. SEE ALSO
io_readfile(3), io_createfile(3), io_socketpair(3) io_pipe(3)
All times are GMT -4. The time now is 07:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy