Copy files in a directory NOT the entire folder possible?

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
elwayisgodAsked:
Who is Participating?
 
QlemoConnect With a Mentor Batchelor, Developer and EE Topic AdvisorCommented:
objFSO.CopyFile SOURCEDIR & "\Data" & "\*", TARGETDIR & "\", True

Open in new window

0
 
elwayisgodAuthor Commented:
If target files exist will it overwrite them automatically with no pop ups?
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Yes, that is what the True is for.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
elwayisgodAuthor Commented:
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
 
elwayisgodAuthor Commented:
Perfect
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Yes, the copy has to be finished first before the command will return execution to your code.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.