Solved

Copy files in a directory NOT the entire folder possible?

Posted on 2013-01-03
6
308 Views
Last Modified: 2013-01-03
Can I easily have the code change to just copy all files in the directory and not copy the entire folder which includes sub folders that I don't want copied.  Want to keep it VB Script.

      objFSO.CopyFolder SOURCEDIR & "\Data", TARGETDIR & "\", True
0
Comment
Question by:elwayisgod
  • 3
  • 3
6 Comments
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 38740607
objFSO.CopyFile SOURCEDIR & "\Data" & "\*", TARGETDIR & "\", True

Open in new window

0
 

Author Comment

by:elwayisgod
ID: 38740643
If target files exist will it overwrite them automatically with no pop ups?
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 38740760
Yes, that is what the True is for.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:elwayisgod
ID: 38740786
So I thought the True was for the script to wait until this part is done before continuing.  I guess not :)  Anyways, this will process before it continues on down the main script?
0
 

Author Closing Comment

by:elwayisgod
ID: 38741056
Perfect
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 38741244
Yes, the copy has to be finished first before the command will return execution to your code.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Show hidden user account 7 55
Scraping specific data within an XML document 19 54
Help me. 3 46
ASP CDO - Limiting Connections 2 40
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now