rm: Unable to remove directory /mnt/users/test/logs/: File exists


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers rm: Unable to remove directory /mnt/users/test/logs/: File exists
# 1  
Old 07-04-2008
rm: Unable to remove directory /mnt/users/test/logs/: File exists

rm: Unable to remove directory /mnt/users/test/logs/: File exists

ls -latr

total 191208
drwxrwxrwx 6 test echo 4096 Jul 3 22:36 ..
-rwxrwxrwx 1 test echo 97692804 Jul 3 22:36 .nfsDFA4
drwxrwxr-x 2 test echo 4096 Jul 3 23:00 .


M not able to delete ".nfsDFA4" file.


Please suggest.

Thanks,
Solitare123
# 2  
Old 07-04-2008
If it is a mount point , log into the machine where the file is present physically and delete it..
# 3  
Old 07-04-2008
If you have lsof, try to grep the filename on it's output and see which process has it opened.

EDIT: Maybe use "fuser -u <filename>" too

Last edited by zaxxon; 07-04-2008 at 04:21 AM..
# 4  
Old 07-04-2008
If its on a NFS mount point, you must delete it from the NFS server itself. Could be perssion issues. And you can't delete a directory staright away if it consists of files in it, unless you perform a rm -rf (use with care!)
# 5  
Old 08-12-2008
Had the same problem. Thanks zaxxon, Your Solution Worked For Me!

Had a directory called "play". Looked empty.
But had a .nfs<xxxx> file that would not go away.
From the parent directory, I executed:

fuser -u play/.*

The result included:

play/.:
play/.nfsC54A: 5794o(esmith)


I then executed:

kill -9 5940
rmdir play


Voila! Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Check that at least one file exists in the directory.

There are some files with suffix dates like abc_20032019.dat abc_17032019.dat If at least one file exists then perform some operation else exit from execution. Korn shell ---------------------------------- array=($inputdir/abc*.dat) If ] ] then echo " file exits" else echo " file does... (10 Replies)
Discussion started by: Rajesh123
10 Replies

2. Shell Programming and Scripting

Unable to check if file exists on remote server using expect

Hi, I need to check if a file exists on remote server using expect. #!/bin/bash ip_addr=10.10.10.10 user=root passwd=Help filename=/root/test expect -c " spawn ssh -n -T -o NumberOfPasswordPrompts=3 -o StrictHostKeyChecking=no $user@$ip_addr expect \"*?assword:*\" send --... (6 Replies)
Discussion started by: temp_user
6 Replies

3. Shell Programming and Scripting

Check whether file exists in directory

Hi guys, I am beginner trying to learn unix. So any help is welcomed. My requirement is to check whether is a file exists in a particular directory or not. The directory path and filename are taken dynamically with user interaction. So the program should continue only if the $filename... (1 Reply)
Discussion started by: maris_markur
1 Replies

4. Shell Programming and Scripting

How to check if the file exists in directory?

Hi Gurus, I have a requests to find if all the file in the filelist exist in certain directory. example: my filelist abc def ddd cde afg how can I find these 5 files exists at director /home/abc Thanks in advance (7 Replies)
Discussion started by: ken6503
7 Replies

5. Shell Programming and Scripting

How to check if a file exists in a directory?

I want to perform SQL *Loader operation only if a file named "load.txt" exists in a directory "/home/loc/etc". Please help how to check this with a if condition. (8 Replies)
Discussion started by: vel4ever
8 Replies

6. Shell Programming and Scripting

check if directory and file exists

cp $PATHLOGS/$DATE/*.* $TMP/logs_tmp/ cp $PATHLOGS/$DATE1/*.* $TMP/logs_tmp/ Before copying the files I have to check if the directory $DATE1 and $DATE2 exists. If directory exists then, check if the folder contains some files. if the file exists then, check if the file size is greater... (3 Replies)
Discussion started by: sandy1028
3 Replies

7. Shell Programming and Scripting

mnt point of a directory

how can we know mount point of a particular directory. I want to know if a particular directory <Dir1> is a mount point somewhere and if so where especially i don't know where it fits with df -k command. (0 Replies)
Discussion started by: tostay2003
0 Replies

8. Shell Programming and Scripting

Problem when test to see if directory exists

Hi, I'm writing a shell script that will create a folder if it does not exist yet. Here's the script: (this if statement is inside a while loop) folderName="Pics" if ! test -d folderName then mkdir $folderName fi However, after the folder Pics has been created, every time the... (3 Replies)
Discussion started by: trivektor
3 Replies

9. UNIX for Dummies Questions & Answers

rm: Unable to remove directory xxxx/xxxx: File exists

Hi Everyone, I am having problem to delete an "empty" folder ( messages attached ). It displays "total 12" when i typed "ls -lart" on the fnxroot44 folder, but i can't view any file. Is there any way to view those unseen files ? I don't know why option "a" is not working this time. Would... (1 Reply)
Discussion started by: deejay
1 Replies
Login or Register to Ask a Question