# Ftp a full directory and subdir

**URL:** https://www.finalbuilder.com/forums/t/ftp-a-full-directory-and-subdir/960
**Category:** Discussion
**Created:** [September 6, 2008, 10:35am UTC](https://www.finalbuilder.com/forums/t/ftp-a-full-directory-and-subdir/960 "2008-09-06T10:35:16Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pkellner](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/pkellner/32/94_2.png) [@pkellner](https://www.finalbuilder.com/forums/u/pkellner)
#### Post date: [September 6, 2008, 10:35am UTC](https://www.finalbuilder.com/forums/t/ftp-a-full-directory-and-subdir/960/1 "2008-09-06T10:35:16Z")

</div>

I've got my script to the point I have my full directory (with subdirectories) that I want to move up to my iis server.What I want to do is first, delete all the files and subdirectories on the remote server, then upload everything from my local directory to the server.&nbsp; I've been playing around for a while and not getting it.&nbsp; This seems like something anyone with ftp access only to a server would have to do to make a clean deployment.

Any suggestions? I've scoured the forums and don't see anything.

thanks,

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [September 8, 2008, 4:28am UTC](https://www.finalbuilder.com/forums/t/ftp-a-full-directory-and-subdir/960/2 "2008-09-08T04:28:14Z")

</div>

The FTP Delete Directory action can delete the files on the server. On the client side, you will need to create a Fileset with the files you want to upload, and then use that fileset with the FTP upload action.

---

<div class="post-metadata">

### Author: ![pkellner](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/pkellner/32/94_2.png) [@pkellner](https://www.finalbuilder.com/forums/u/pkellner)
#### Post date: [September 8, 2008, 5:09am UTC](https://www.finalbuilder.com/forums/t/ftp-a-full-directory-and-subdir/960/3 "2008-09-08T05:09:16Z")

</div>

can that process be automated? I couldn’t figure out what actions to use to build a recursive delete or a recursive copy.

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [September 8, 2008, 7:00am UTC](https://www.finalbuilder.com/forums/t/ftp-a-full-directory-and-subdir/960/4 "2008-09-08T07:00:05Z")

</div>

Use the FTP Delete Directory action with the recurse option turned on. Then use a FileSet Define action to define the list of files you want to upload, and in the FTP Upload action specify the FileSet instead of a file spec. So the actions you would need :   
  
 FTP Connection   
 FTP Delete Directory   
 FileSet Define   
 FTP Upload   
 FTP Disconnect   
  
 HTH
