Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Task Scheduler or VBA to simple copy periodically folders contents toexternal drive

I need to copy periodically all files (without any other data
manipulation)
from folders W, X, Y on Drive C to folder Z on Drive D.
Any existing files would ge ovewritten without prompting.
Is it more convenient to process this through Windows Task Scheduler
or through VBA ?

Help appreciated,

J.P.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Task Scheduler or VBA to simple copy periodically folders contents to external drive

If you need to work only with files, not subfolders, you can use code
like the following:


Sub AAA()
Dim FromFolders As Variant
Dim ToFolder As String
Dim N As Long
Dim FName As String
FromFolders = Array("C:\Test", "C:\Test2")
ToFolder = "D:\Z"
Application.DisplayAlerts = False
For N = LBound(FromFolders) To UBound(FromFolders)
ChDrive FromFolders(N)
ChDir FromFolders(N)
FName = Dir("*.*", vbNormal)
Do Until FName = vbNullString
On Error Resume Next
Kill ToFolder & "\" & FName
On Error GoTo 0
Name FName As ToFolder & "\" & FName
FName = Dir()
Loop
Next N
End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com





On Fri, 5 Mar 2010 13:52:56 -0800 (PST), u473 wrote:

I need to copy periodically all files (without any other data
manipulation)
from folders W, X, Y on Drive C to folder Z on Drive D.
Any existing files would ge ovewritten without prompting.
Is it more convenient to process this through Windows Task Scheduler
or through VBA ?

Help appreciated,

J.P.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
task scheduler Big Jim New Users to Excel 0 June 1st 06 07:00 PM
Task Scheduler timothyp[_3_] Excel Programming 0 September 22nd 04 08:47 PM
Task Scheduler Jarek[_15_] Excel Programming 0 September 22nd 04 01:54 PM
Task Scheduler Randy[_15_] Excel Programming 1 September 8th 04 07:37 PM
Task Scheduler Rone Excel Programming 1 December 12th 03 06:10 PM


All times are GMT +1. The time now is 06:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"