Solved

Deleting directory on remote server

Posted on 2011-09-10
2
475 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 250 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 250 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

690 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