Purging files and directories in a A:\ drive

Posted on 1998-12-08
Medium Priority
Last Modified: 2012-05-04
Anyone knows how to write delphi codes to purge all files and directories from the diskette in Delphi 3 ?
Question by:n_chai
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
LVL 12

Accepted Solution

rwilson032697 earned 600 total points
ID: 1349969
Answer coming...
LVL 12

Expert Comment

ID: 1349970

Do something like this which recursively deletes all files and directories.

procedure KillAllFiles(FilePath : String);

  SearchRec : TSearchRec;

//first kill the directories (recursively)

  FindFirst(filepath, faDirectory, SearchRec);
    KillAllfiles(ExtractFilepath(FilePath) + '\' + searchrec.name + '\*.*')
  until (FindNext(SearchRec) = 0)


// Now kill the files

  FindFirst(filepath, faAnyFile, SearchRec);
     deletefile(ExtractFilePath(Filepath)+ '\' + searchrec.name)
  until FindNext(SearchRec) = 0;


call it like this:





Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month12 days, 11 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