?
Solved

Deleting directory on remote server

Posted on 2011-09-10
2
Medium Priority
?
486 Views
Last Modified: 2016-09-30
At a click of a button, I want to give the user the option of deleting a directory on a web server.  The path to this directory is always the same (home/username/http-docs/somedirectory) where a directory called "somedirectory" will be deleted.  Unfortunately a directory cannot be deleted when it has other directories & files in it and these will differ.  I already have the code to log in/out of the server. All I need is  some code to do EITHER of the following:

1. Code to delete this directory even if it is not empty.

OR...

2. List all the directories and files in a directory and ALSO their sub-directories. Everything has to be listed so I can set up a delete routine. I already have the path to the top directory.

I am using a FTP component called ipwFTP1 which can use commands listed at:
http://nsoftware.com/products/component/ftp.aspx

I am using Delphi 6.  This is URGENT so I am giving the maximum 500 points for this. Many thanks for your help.
0
Comment
Question by:rincewind666
2 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 500 total points
ID: 36516779
No need to setup a delete routine.  I dont know how to do it in Delphi but the algorithmis basically this

DeleteDirectory (DirectoryName)

   For each file in DirectoryName
        If File isDirectory then   (ipwFTP1  DirListIsDir)
            DeleteDirectory(File)  
            Remove File     (ipwFTP1  RemoveDirectory)
   Next File
   Remove DirectoryName     (ipwFTP1  RemoveDirectory)

End

mlmcc
0
 
LVL 28

Assisted Solution

by:Sinisa Vuk
Sinisa Vuk earned 500 total points
ID: 36528662

Maybe you can try send string command (not using direct command):

RMDIR -r <dir_name>
or
RMDIR -rf <dir_name>

this depends on ftp server flavor.

Sinisa V.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question