View Full Version : cgi code to delete directory
nitroboy
March 8th, 2002, 11:50
I don't know how this happened, but I have a directory (folder) that I can't delete
it says this: can't remove directory: directory not empty
but this dir is empty :confused2
I know there's a small cgi code to execute something like this but I don't know how to write....
anyone can help?
Dusty
March 8th, 2002, 12:52
#!perl
rmdir("/path/to/directory");Are you certain the directory is empty?
Dumbbell69
March 8th, 2002, 13:29
Some hidden files still exist in that directory.
is0lized
March 8th, 2002, 13:31
easy
connect *.*.*.*
login
pass
cd the/dir/location
cd ..
rm -r dir
logout
nitroboy
March 8th, 2002, 14:40
Originally posted by Dumbbell69
Some hidden files still exist in that directory.
yes but how do I remove these?
Dusty
March 8th, 2002, 18:39
I'd imagine whatever FTP program you're using would have an option to show hidden files. If not, here's a script to completely empty and delete a directory:
#!perl
$directory="/path/to/directory/to/delete";
opendir(DIR,$directory);
@files=readdir(DIR);
closedir(DIR);
foreach $file(@files){
if(($file ne ".")&&($file ne "..")&&(!-d $file)){
unlink $directory."/".$file;
}
}
rmdir($directory);
keith
March 8th, 2002, 19:59
do you still have a .htaccess file in the directory that the host doesn't allow shown in ftp? i'll bet that's the problem. dusty's site has a delete.cgi file that works nicely for those... "nobody delete"
http://www.go2cgi.com
niv
March 8th, 2002, 20:09
#!perl
$dir_path="you know what goes here :rolleyes:";
# For *NIX only:
# system("rm -rf $dir_path");
# For Winblows only:
# system("del -R $dir_path");
# uncomment the one you need.
nitroboy
March 9th, 2002, 04:36
Originally posted by keith
do you still have a .htaccess file in the directory that the host doesn't allow shown in ftp? i'll bet that's the problem. dusty's site has a delete.cgi file that works nicely for those... "nobody delete"
http://www.go2cgi.com
thanks keith (and dusty who made that script)
it worked for me, the hidden file called .welcome and I was able to remove it :classic2:
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.