Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System calls in unix

Status
Not open for further replies.

jimberger

Programmer
Jul 5, 2001
222
GB
hi all,

I am creating a a cgi script in perl. I want to use delete a directory so i am using a system call.

system("rm -r $path");

However, this dosen't remove the directory. In the apache error logs i get the error message

rm: Unable to remove directory ....name of directory...: File exists

Any ideas? I have used this system call in other scripts and got it to work. My web server is running apache on unix.

Many thanks
 
It's likely that there's a file in that directory that is still open, by your process or something else. When a file is open and someone else deletes it only the name in the directory disappears - the file is still there until it's finally closed.

I would guess that the same applies if some process has a subdirectory of that directory as its working directory. Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Jimberger

might be worth checking permissions on the directory in question and that you are not trying to delete the directory form within it, or from below it.

On some Unix/Linux boxes there is a command to check which usrer are using a file. Had a command called fuser on an HP box once.

Good Luck!
Loon
 
Sorry for the typos.. hit Submit rather than Preview...
(form=from usrer=user)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top