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
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
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
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
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
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
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
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
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
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
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
LEARN ABOUT OSF1
mktrashcan
mktrashcan(1) General Commands Manual mktrashcan(1)
NAME
mktrashcan, rmtrashcan, shtrashcan - Attaches, detaches, or shows a trashcan directory
SYNOPSIS
/usr/sbin/mktrashcan trashcan directory...
/usr/sbin/rmtrashcan directory...
/usr/sbin/shtrashcan directory...
OPERANDS
Specifies the directory that contains files that were deleted from attached directories. Whenever you delete a file in the specified
directory, the file system automatically moves the file to the trashcan directory. Specifies the directory that you attach to a trashcan
directory.
DESCRIPTION
The trashcan utilities (mktrashcan and rmtrashcan) enable you to attach or detach an existing directory, which you specify as a trashcan
directory, to any number of directories within the same fileset.
A trashcan directory stores the files that are deleted with the unlink system call. For instance, you can use the mktrashcan utility to
attach a trashcan directory called /usr/trashcan to one or more directories; thereafter, when you delete a file from one of the attached
directories, the file system moves the file to the /usr/trashcan directory. Note that when more than one directory shares attachment to a
trashcan directory, files with the same file name can overwrite each other in the trashcan directory.
If you mistakenly delete a file, use the mv command to return the file from the /usr/trashcan directory to its original directory.
When you enter shtrashcan at the system prompt, the system shows the trashcan directory, if one exists, for the directory you specified.
It is important that trashcan directories have correct access permissions. If the permissions are too restrictive, then it may be impossi-
ble to remove files from the directories that are attached to the trashcan directory. In general, all users and groups that expect to use
the trashcan directory need write permission to the directory. If unexpected "permission denied" errors occur when deleting files that are
in a directory attached to a trashcan directory, use the chmod command to change the permissions on the trashcan directory.
RESTRICTIONS
The directory and trashcan directories must be in the same fileset; however, you can attach the trashcan directory to any directory within
the fileset.
EXAMPLES
The following example creates and attaches a trashcan directory, /usr/trashcan, to two directories, /usr/ray and /usr/projects/sql/test,
which are in the same fileset. The chmod command adds write permission for all users and groups on the new trashcan directory. % mkdir
/usr/trashcan % chmod a+w /usr/trashcan % mktrashcan /usr/trashcan /usr/ray /usr/projects/sql/test To attach the trashcan directory,
/usr/trashcan, to all subdirectories in the /usr directory, enter: % mktrashcan /usr/trashcan /usr/*
New subdirectories that you add beneath the /usr directory are not attached to the trashcan directory until you attach them. Also,
the mktrashcan utility distinguishes between directories and files, attaching only directories to the trashcan directory.
Note that an attached directory produces an EDUPLICATE_DIRS (-1165) error when /usr/trashcan is itself in the directory path you
attach to (as in the previous example). You can ignore this error message.
SEE ALSO
advfs(4), mkfset(8), showfsets(8)
mktrashcan(1)