• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 815
  • Last Modified:

VB Script to copy files if file doesn't exist in target directory.

I found this code that someone posted and it works great except I want to make it copy all sub folders and files with file ownership and ACL information. Can this even be done?


Const strSOURCE = "c:\test\"
Const strTARGET = "c:\test-2\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set fol = fso.GetFolder(strSOURCE)
For Each fil in fol.Files
    If (Not fso.FileExists(strTARGET & fil.Name)) Then
         fso.Copyfile strSOURCE & fil.Name, strTarget, true          
    End If
Next

MsgBox lngCount & " files copied", vbInformation , "Image Copy Complete"
0
chobus
Asked:
chobus
  • 3
  • 3
1 Solution
 
chandru_solCommented:
I think it is better to use Robocopy from Microsoft for copying data which will copy with ACL's

Give it a try
0
 
chobusAuthor Commented:
What is Robocopy? Can it copy to Network Drives?
0
 
chandru_solCommented:
Yes you can use it to copy to network drives

Robocopy is a microsoft tool which many IT adminsitrators use to copy

http://www.ss64.com/nt/robocopy.html

The above link will give you a good start.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
chobusAuthor Commented:
How do I get Robocopy? I didn't see a download at http://www.ss64.com/nt/robocopy.html
0
 
chobusAuthor Commented:
I found a Windows Server 2003 Resource Kit Tools that has it but what can I do for Windows server 2000?
0
 
chandru_solCommented:
You can download the resource kit for windows 2003 as robocopy is part of it.

Robocopy GUI can be downloaded here

http://www.microsoft.com/technet/technetmag/issues/2006/11/UtilitySpotlight/
0

Featured Post

Independent Software Vendors: 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!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now