Gossamer Forum
Home : General : Perl Programming :

Directory Deleting Script.

Quote Reply
Directory Deleting Script.
Hi,

Basically, I have a directory with lots of subdirectories. I use the Links V2.0 script to create a "portal" page like yahoo.com. Now, when I delete a cat/link, the actual pages continue to stay on the server. Does anyone have/know of/a script that will simply delete the entire root directory and all the subdirectories?

It would really help me a lot.

Thanks a lot.
Regards.
Abbas.

Quote Reply
Re: Directory Deleting Script. In reply to
Mmmm, that would be a nice feature in Links 2. Does anyone have a md for it??? Cool

Andy

http://www.ace-installer.com
webmaster@Ace-installer.com
Quote Reply
Re: Directory Deleting Script. In reply to
It is pretty difficult to do because the rmdir command requires that all directories be empty before they can be deleted.

Alex will know more I expect.

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Directory Deleting Script. In reply to
Hello all, again.

My skill at perl/cgi is zero, but how about this suggestion:

The cgi script looks at all the directories, and puts all the files and directory names into a text file (temp file).
It then proceeds to delete each file and directory individually.

Would that work/is that possible?

Thanks a lot.
Abbas.

Quote Reply
Re: Directory Deleting Script. In reply to
How about using the rm -r command?

Wil

Quote Reply
Re: Directory Deleting Script. In reply to
You should be able to use the rm -rf command to recursively delete directories (emtpy or not). -r is the recursive, while -f is the force command line option.

-- Michael

Quote Reply
Re: Directory Deleting Script. In reply to
The only caveat is if the pages were created with the server permissions, then you won't be able to delete them as "you" (unless you can become root).

You may need to get one of the scripts that run as the server (cgi-based) to do the work, then remove the scripts from your server for security. I believe there were a few on cgi-resources.

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: Directory Deleting Script. In reply to
www.cybernox.com/scripts/wipeout.html

Be careful.

--mark

Installation support is provided via ICQ at UIN# 53788453. I will only respond on that number.
Quote Reply
Re: Directory Deleting Script. In reply to
Would that remove directories that contained files?

..and would something like the following work?:

#!/usr/local/bin/perl
rm -r /path to main links directory/

would the above work?

Thanks.
Regards.
Abbas.

Quote Reply
Re: Directory Deleting Script. In reply to
Sorry - post deleted.

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Directory Deleting Script. In reply to
Thanks for the hlp Mark and everybody!

Regards.
Abbas.