Board index » delphi » recurse through a directory tree and copy files and directories

recurse through a directory tree and copy files and directories

I'm writing a program that will upgrade a web-appliation to the latest version. It runs some scripts in the database and if this succeeded, it copies the latest source-code for the site over the current code.

So - I need a way to recurse through the entire tree so that I can copy each of the files. There might even be directories added since the previous version that needs to be created.

Does anyone know of delphi functions/components that will help me with this? Has anyone written any similar code?

Thanx
Le Roux

 

Re:recurse through a directory tree and copy files and directories


Yes,
it is rather simple.
findfirst/findnext is used to get the directory tree.

Rene
--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com

Quote
Le Roux wrote:

> I'm writing a program that will upgrade a web-appliation to the latest version. It runs some scripts in the database and if this succeeded, it copies the latest source-code for the site over the current code.

> So - I need a way to recurse through the entire tree so that I can copy each of the files. There might even be directories added since the previous version that needs to be created.

> Does anyone know of delphi functions/components that will help me with this? Has anyone written any similar code?

> Thanx
> Le Roux

Re:recurse through a directory tree and copy files and directories


I have written a simple directory tree scanner at:

  http://www.david-taylor.pwp.blueyonder.co.uk/software/components.html

which comes with source code.  Your program gets called for each file and
each folder found in the tree, and you can set what is scanned for e.g.
*.pas or whatever.  For copying I would use the functions in the ShellAPI.

If it helps, great.

Cheers,
David

Other Threads