# Empty Subfolders

**URL:** https://www.finalbuilder.com/forums/t/empty-subfolders/612
**Category:** Discussion
**Created:** [October 10, 2007, 8:38am UTC](https://www.finalbuilder.com/forums/t/empty-subfolders/612 "2007-10-10T08:38:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![djmarks](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@djmarks](https://www.finalbuilder.com/forums/u/djmarks)
#### Post date: [October 10, 2007, 8:38am UTC](https://www.finalbuilder.com/forums/t/empty-subfolders/612/1 "2007-10-10T08:38:04Z")

</div>

This might have been asked but I have a project where I take two file locations

Location A is a subset of Location B so I have to take away locations A files.

There are two ways to accomplish this.&nbsp; One i suse the file iterate and check to see if location "b"'s file exisit in location "a".&nbsp; If it does not exisit then I can copy it to location C from my build process.&nbsp; This i use the Path manupulation to strip the path of and name off so when I copy the file to location C I can maintain the additional paths that are used with the files.&nbsp; I use Robocopy to perform the copy after geting the path&nbsp; taken away.

Example

Location A&nbsp;&nbsp; - \\ServerLoc\Share\MainData\\*.\*&nbsp; - Recursive from here

Location B - \\ServerLoc\Share\SecondaryData\\*.\*&nbsp; - Recursive from here

Location C - Localdrive\path\..\file startlocation

So when I end up I get Location "C" with the recursive path to the files that only reside in Location B.&nbsp; This is taking a very long time to run checking over 3000 files.

The other option is copy Location B down to location C then stip away the files that location has in location C.&nbsp; This is very quick but leaves behind a massive amount of empty directories.&nbsp; I can write vbscript code to remove empty directories and empty subdirectories with file count of 0 and subfolder count of 0.&nbsp; But I was looking how do I do this with the internal functions within finalbuilder?

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

### Author: ![djmarks](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@djmarks](https://www.finalbuilder.com/forums/u/djmarks)
#### Post date: [October 11, 2007, 4:47am UTC](https://www.finalbuilder.com/forums/t/empty-subfolders/612/2 "2007-10-11T04:47:55Z")

</div>

I found a work around that works.&nbsp;

Copy location A down to location C temp location.&nbsp;

Take the files iterate from location B and string replace it with location C root path.&nbsp;

Then delete the files if they exist.&nbsp; - "This takes the longest time."&nbsp;

I do a FileSet Derfine to location C getttng all the files.&nbsp;

Move the fileset to the real location of C.&nbsp;

Delete the temp location.&nbsp;&nbsp;

&nbsp;

This all take about 9 minutes to work.&nbsp; The other way I stated with uising iterates from file A to B and only copying the difference to location C took too long to execute.

Dennis

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [October 12, 2007, 2:28am UTC](https://www.finalbuilder.com/forums/t/empty-subfolders/612/3 "2007-10-12T02:28:51Z")

</div>

Hi Dennis,   
  
 I’m glad you found a workaround. I have some ideas for actions which should make this kind of thing easy to do, so I’ve added them to the to-do list… but we’re pretty busy, so it may be a while before they see the light of day. :-).   
  
 Regards,   
  
 Angus

---

<div class="post-metadata">

### Author: ![djmarks](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@djmarks](https://www.finalbuilder.com/forums/u/djmarks)
#### Post date: [October 12, 2007, 6:44am UTC](https://www.finalbuilder.com/forums/t/empty-subfolders/612/4 "2007-10-12T06:44:07Z")

</div>

The work around is okay but my scripted project took less time 15 minutes to using finalbuilder is now to 45 minutes!&nbsp; I will see if I can find another solution with the check file after the influx of items here have settled down.

&nbsp;
