?
Solved

Deleting directory on remote server

Posted on 2011-09-10
2
Medium Priority
?
478 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 27

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month13 days, 4 hours left to enroll

777 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