Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Deleting directory on remote server

Posted on 2011-09-10
2
Medium Priority
?
482 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 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

Industry Leaders: 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
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…
Suggested Courses

610 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