Hi

I haven't the slightest idea about scripts, I have been trying to write a
batch file to do the job, with no success and I have been informed that a
script is what I need.

Here is my predicament:
This action needs to work in an NT and XP environment

I need to move files at the end of ever month stored in 2 different folders,
to a backup location.
For example this is where the files are located:
p:\cmanger\{Workstation_name}\Dailydoc
p:\cmanger\{Workstation_name}\DailyImg

I would like all the files within the 2 folders all moved to
p:\cmanger\backup\DailyDoc & p:\cmanger\backup\DailyImg
Which should then leave the original file locations empty.

However each workstation I need to perform the action on has a different
folder name in the middle.
It's always the workstation name, if this helps?

Is it possible to write a script to automatically perform this action at the
end of each month.
If so, would it also be possible to move them to a folder of the time period
i.e. named "yyyymmdd" each time the script runs.

Your expert help on this would be most appreciated.

Regards,

Bradley

Re: Copying Folder Contents by McKirahan

McKirahan
Thu Aug 18 21:53:50 CDT 2005

"Bradley" <bradley@tailormadeit.co.uk> wrote in message
news:#8MVHbEpFHA.2916@TK2MSFTNGP14.phx.gbl...
> Hi
>
> I haven't the slightest idea about scripts, I have been trying to write a
> batch file to do the job, with no success and I have been informed that a
> script is what I need.
>
> Here is my predicament:
> This action needs to work in an NT and XP environment
>
> I need to move files at the end of ever month stored in 2 different
folders,
> to a backup location.
> For example this is where the files are located:
> p:\cmanger\{Workstation_name}\Dailydoc
> p:\cmanger\{Workstation_name}\DailyImg

>
> I would like all the files within the 2 folders all moved to
> p:\cmanger\backup\DailyDoc & p:\cmanger\backup\DailyImg
> Which should then leave the original file locations empty.
>
> However each workstation I need to perform the action on has a different
> folder name in the middle.
> It's always the workstation name, if this helps?
>
> Is it possible to write a script to automatically perform this action at
the
> end of each month.
> If so, would it also be possible to move them to a folder of the time
period
> i.e. named "yyyymmdd" each time the script runs.
>
> Your expert help on this would be most appreciated.
>
> Regards,
>
> Bradley
>
>


Will this work for you? Watch for word-wrap.

It also appends a line to a log file.

You can use the Windows Task Scheduler to run it at EOM.


Option Explicit
'*
'* Declare Constants
'*
Const cVBS = "pcmanger.vbs"
Const cLOG = "pcmanger.log"
Const cFR1 = "p:\cmanger\?\Dailydoc"
Const cFR2 = "p:\cmanger\?\DailyImg"
Const cTO1 = "p:\cmanger\backup\DailyDoc\?"
Const cTO2 = "p:\cmanger\backup\DailyImg\?"
Const cWSS = "COMPUTERNAME"
'*
'* Declare Variables
'*
Dim strFR1 '= FROM folder #1
Dim strFR2 '= FROM folder #2
Dim strMSG '= Message
Dim strNOW '= Current Date+Time
strNOW = Now
Dim strSFN '= Script Full Name's Folder
strSFN = WScript.ScriptFullName
strSFN = Left(strSFN,InStrRev(strSFN,"\"))
Dim strTO1 '= TO folder #1
Dim strTO2 '= TO folder #2
Dim strWKS '= Workstation
Dim strWSS '= Environment
Dim strYMD '= YYYYMMDD
strYMD = DatePart("yyyy",strNOW)
strYMD = strYMD & Right(100+DatePart("m",strNOW),2)
strYMD = strYMD & Right(100+DatePart("d",strNOW),2)
'*
'* Declare Objects
'*
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objOTF
Set objOTF = objFSO.OpenTextFile(strSFN & cLOG,8,True)
Dim objWSS
Set objWSS = CreateObject("WScript.Shell")
'*
'* Workstation Name (e.g. "COMPUTERNAME=ABC123" )
'*
For Each strWSS in objWSS.Environment("Process")
If Left(strWSS,Len(cWSS)) = cWSS Then
strWKS = Mid(strWSS,Len(cWSS)+2)
End If
Next
strFR1 = Replace(cFR1,"?",strWKS)
strFR2 = Replace(cFR2,"?",strWKS)
strTO1 = Replace(cTO1,"?",strYMD)
strTO2 = Replace(cTO2,"?",strYMD)
strMSG = strWKS & " = "
'*
'* Copy Files (w/ overwrite) the Delete Files
'*
If objFSO.FolderExists(strFR1) _
And objFSO.FolderExists(strFR2) _
And Not objFSO.FolderExists(strTO1) _
And Not objFSO.FolderExists(strTO2) Then
objFSO.CreateFolder strTO1
objFSO.CopyFile strFR1 & "\*.*", strTO1, True
objFSO.DeleteFile strFR1 & "\*.*", True
objFSO.CreateFolder strTO2
objFSO.CopyFile strFR2 & "\*.*", strTO2, True
objFSO.DeleteFile strFR2 & "\*.*", True
strMSG = "Successful!"
Else
strMSG = "Failed!"
End If
objOTF.WriteLine(strNOW & " : " & strWKS & " = " & strMSG)
'*
'* Destroy Objects
'*
Set objFSO = Nothing
Set objOTF = Nothing
Set objWSS = Nothing
'*
'* Display Message
'*
MsgBox strMSG,VBInformation,cVBS



Re: Copying Folder Contents by Bradley

Bradley
Fri Aug 19 05:18:57 CDT 2005

"McKirahan" <News@McKirahan.com> wrote in message
news:s6ydncgAONMj1JjeRVn-qg@comcast.com...
> "Bradley" <bradley@tailormadeit.co.uk> wrote in message
> news:#8MVHbEpFHA.2916@TK2MSFTNGP14.phx.gbl...
>> Hi
>>
>> I haven't the slightest idea about scripts, I have been trying to write a
>> batch file to do the job, with no success and I have been informed that a
>> script is what I need.
>>
>> Here is my predicament:
>> This action needs to work in an NT and XP environment
>>
>> I need to move files at the end of ever month stored in 2 different
> folders,
>> to a backup location.
>> For example this is where the files are located:
>> p:\cmanger\{Workstation_name}\Dailydoc
>> p:\cmanger\{Workstation_name}\DailyImg
>
>>
>> I would like all the files within the 2 folders all moved to
>> p:\cmanger\backup\DailyDoc & p:\cmanger\backup\DailyImg
>> Which should then leave the original file locations empty.
>>
>> However each workstation I need to perform the action on has a different
>> folder name in the middle.
>> It's always the workstation name, if this helps?
>>
>> Is it possible to write a script to automatically perform this action at
> the
>> end of each month.
>> If so, would it also be possible to move them to a folder of the time
> period
>> i.e. named "yyyymmdd" each time the script runs.
>>
>> Your expert help on this would be most appreciated.
>>
>> Regards,
>>
>> Bradley
>>
>>
>
>
> Will this work for you? Watch for word-wrap.
>
> It also appends a line to a log file.
>
> You can use the Windows Task Scheduler to run it at EOM.
>
>
> Option Explicit
> '*
> '* Declare Constants
> '*
> Const cVBS = "pcmanger.vbs"
> Const cLOG = "pcmanger.log"
> Const cFR1 = "p:\cmanger\?\Dailydoc"
> Const cFR2 = "p:\cmanger\?\DailyImg"
> Const cTO1 = "p:\cmanger\backup\DailyDoc\?"
> Const cTO2 = "p:\cmanger\backup\DailyImg\?"
> Const cWSS = "COMPUTERNAME"
> '*
> '* Declare Variables
> '*
> Dim strFR1 '= FROM folder #1
> Dim strFR2 '= FROM folder #2
> Dim strMSG '= Message
> Dim strNOW '= Current Date+Time
> strNOW = Now
> Dim strSFN '= Script Full Name's Folder
> strSFN = WScript.ScriptFullName
> strSFN = Left(strSFN,InStrRev(strSFN,"\"))
> Dim strTO1 '= TO folder #1
> Dim strTO2 '= TO folder #2
> Dim strWKS '= Workstation
> Dim strWSS '= Environment
> Dim strYMD '= YYYYMMDD
> strYMD = DatePart("yyyy",strNOW)
> strYMD = strYMD & Right(100+DatePart("m",strNOW),2)
> strYMD = strYMD & Right(100+DatePart("d",strNOW),2)
> '*
> '* Declare Objects
> '*
> Dim objFSO
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Dim objOTF
> Set objOTF = objFSO.OpenTextFile(strSFN & cLOG,8,True)
> Dim objWSS
> Set objWSS = CreateObject("WScript.Shell")
> '*
> '* Workstation Name (e.g. "COMPUTERNAME=ABC123" )
> '*
> For Each strWSS in objWSS.Environment("Process")
> If Left(strWSS,Len(cWSS)) = cWSS Then
> strWKS = Mid(strWSS,Len(cWSS)+2)
> End If
> Next
> strFR1 = Replace(cFR1,"?",strWKS)
> strFR2 = Replace(cFR2,"?",strWKS)
> strTO1 = Replace(cTO1,"?",strYMD)
> strTO2 = Replace(cTO2,"?",strYMD)
> strMSG = strWKS & " = "
> '*
> '* Copy Files (w/ overwrite) the Delete Files
> '*
> If objFSO.FolderExists(strFR1) _
> And objFSO.FolderExists(strFR2) _
> And Not objFSO.FolderExists(strTO1) _
> And Not objFSO.FolderExists(strTO2) Then
> objFSO.CreateFolder strTO1
> objFSO.CopyFile strFR1 & "\*.*", strTO1, True
> objFSO.DeleteFile strFR1 & "\*.*", True
> objFSO.CreateFolder strTO2
> objFSO.CopyFile strFR2 & "\*.*", strTO2, True
> objFSO.DeleteFile strFR2 & "\*.*", True
> strMSG = "Successful!"
> Else
> strMSG = "Failed!"
> End If
> objOTF.WriteLine(strNOW & " : " & strWKS & " = " & strMSG)
> '*
> '* Destroy Objects
> '*
> Set objFSO = Nothing
> Set objOTF = Nothing
> Set objWSS = Nothing
> '*
> '* Display Message
> '*
> MsgBox strMSG,VBInformation,cVBS
>
>

Hi McKirahan

That's amazing, I haven't a clue what it all means, but it creates a log
file error

19/08/2005 11:11:09 : STUDY = Failed!

Am I supposed to change something

Regards

Bradley



Re: Copying Folder Contents by McKirahan

McKirahan
Fri Aug 19 06:14:59 CDT 2005

"Bradley" <bradley@tailormadeit.co.uk> wrote in message
news:unDrsdKpFHA.3064@TK2MSFTNGP15.phx.gbl...

[snip]

> Hi McKirahan
>
> That's amazing, I haven't a clue what it all means, but it creates a log
> file error
>
> 19/08/2005 11:11:09 : STUDY = Failed!
>
> Am I supposed to change something
>
> Regards
>
> Bradley
>

One of these four conditions failed:

objFSO.FolderExists("p:\cmanger\STUDY\Dailydoc")
objFSO.FolderExists("p:\cmanger\STUDY\Dailydoc")
Not objFSO.FolderExists("p:\cmanger\backup\DailyDoc\20050819")
Not objFSO.FolderExists("p:\cmanger\backup\DailyImg\20050819")

The first two folders must exist; the second two folders shouldn't exist.


Or did you want the backups to go to the following folders?

p:\cmanger\backup\20050819\DailyDoc
p:\cmanger\backup\20050819\DailyImg



Re: Copying Folder Contents by Bradley

Bradley
Fri Aug 19 07:06:43 CDT 2005

"McKirahan" <News@McKirahan.com> wrote in message
news:Ne2dnYccXcepIpjeRVn-tg@comcast.com...
> "Bradley" <bradley@tailormadeit.co.uk> wrote in message
> news:unDrsdKpFHA.3064@TK2MSFTNGP15.phx.gbl...
>
> [snip]
>
>> Hi McKirahan
>>
>> That's amazing, I haven't a clue what it all means, but it creates a log
>> file error
>>
>> 19/08/2005 11:11:09 : STUDY = Failed!
>>
>> Am I supposed to change something
>>
>> Regards
>>
>> Bradley
>>
>
> One of these four conditions failed:
>
> objFSO.FolderExists("p:\cmanger\STUDY\Dailydoc")
> objFSO.FolderExists("p:\cmanger\STUDY\Dailydoc")
> Not objFSO.FolderExists("p:\cmanger\backup\DailyDoc\20050819")
> Not objFSO.FolderExists("p:\cmanger\backup\DailyImg\20050819")
>
> The first two folders must exist; the second two folders shouldn't exist.
>
>
> Or did you want the backups to go to the following folders?
>
> p:\cmanger\backup\20050819\DailyDoc
> p:\cmanger\backup\20050819\DailyImg
>
>

Hi McKirahan

I notice that my folder is called "CManager" not CManger, so I amended the
lines

Const cVBS = "pcmanager.vbs"
Const cLOG = "pcmanager.log"
Const cFR1 = "p:\cmanager\?\Dailydoc"
Const cFR2 = "p:\cmanager\?\DailyImg"
Const cTO1 = "p:\cmanager\backup\DailyDoc\?"
Const cTO2 = "p:\cmanager\backup\DailyImg\?"
Const cWSS = "COMPUTERNAME"

Then I got a Windows Script Host message...

Script: C:\Documents and Settings\Bradley\Desktop\copyscan.vbs
Line: 60
Char: 9
Error: Path not found
Code: 800A004C
Source: Microsoft VBScript runtime error

So I created the folders "p:\cmanager\backup\DailyDoc" &
"p:\cmanager\backup\DailyImg" and it worked great.

Therefore could the script automatically create these folders
"backup\DailyDoc" & "backup\DailyImg" if they don't exist.

It's amazing how such a little thing can bring so much joy, I was amazed
when it worked. You probably think it part of the norm but I thought it
amazing.

Regards

Bradley



Re: Copying Folder Contents by McKirahan

McKirahan
Sat Aug 20 00:13:44 CDT 2005

"Bradley" <bradley@tailormadeit.co.uk> wrote in message
news:umwg#ZLpFHA.2952@TK2MSFTNGP15.phx.gbl...
> "McKirahan" <News@McKirahan.com> wrote in message
> news:Ne2dnYccXcepIpjeRVn-tg@comcast.com...
> > "Bradley" <bradley@tailormadeit.co.uk> wrote in message
> > news:unDrsdKpFHA.3064@TK2MSFTNGP15.phx.gbl...
> >
> > [snip]
> >
> >> Hi McKirahan
> >>
> >> That's amazing, I haven't a clue what it all means, but it creates a
log
> >> file error
> >>
> >> 19/08/2005 11:11:09 : STUDY = Failed!
> >>
> >> Am I supposed to change something
> >>
> >> Regards
> >>
> >> Bradley
> >>
> >
> > One of these four conditions failed:
> >
> > objFSO.FolderExists("p:\cmanger\STUDY\Dailydoc")
> > objFSO.FolderExists("p:\cmanger\STUDY\Dailydoc")
> > Not objFSO.FolderExists("p:\cmanger\backup\DailyDoc\20050819")
> > Not objFSO.FolderExists("p:\cmanger\backup\DailyImg\20050819")
> >
> > The first two folders must exist; the second two folders shouldn't
exist.
> >
> >
> > Or did you want the backups to go to the following folders?
> >
> > p:\cmanger\backup\20050819\DailyDoc
> > p:\cmanger\backup\20050819\DailyImg
> >
> >
>
> Hi McKirahan
>
> I notice that my folder is called "CManager" not CManger, so I amended the
> lines
>
> Const cVBS = "pcmanager.vbs"
> Const cLOG = "pcmanager.log"
> Const cFR1 = "p:\cmanager\?\Dailydoc"
> Const cFR2 = "p:\cmanager\?\DailyImg"
> Const cTO1 = "p:\cmanager\backup\DailyDoc\?"
> Const cTO2 = "p:\cmanager\backup\DailyImg\?"
> Const cWSS = "COMPUTERNAME"
>
> Then I got a Windows Script Host message...
>
> Script: C:\Documents and Settings\Bradley\Desktop\copyscan.vbs
> Line: 60
> Char: 9
> Error: Path not found
> Code: 800A004C
> Source: Microsoft VBScript runtime error
>
> So I created the folders "p:\cmanager\backup\DailyDoc" &
> "p:\cmanager\backup\DailyImg" and it worked great.
>
> Therefore could the script automatically create these folders
> "backup\DailyDoc" & "backup\DailyImg" if they don't exist.
>
> It's amazing how such a little thing can bring so much joy, I was amazed
> when it worked. You probably think it part of the norm but I thought it
> amazing.
>
> Regards
>
> Bradley
>

Try this:

'*
'* Create Backup Folders
'*
strTO1 = Replace(cTO1,"\?","")
strTO2 = Replace(cTO2,"\?","")
If Not objFSO.FolderExists(strTO1) Then
objFSO.CreateFolder strTO1
End If
If Not objFSO.FolderExists(strTO2) Then
objFSO.CreateFolder strTO2
End If
'*
'* Workstation Name (e.g. "COMPUTERNAME=ABC123" )
'*

Of course, the folder:
"p:\cmanager\backup"
must already exist for the above to work.



Re: Copying Folder Contents by Bradley

Bradley
Sat Aug 20 03:21:50 CDT 2005

"McKirahan" <News@McKirahan.com> wrote in message
news:2LOdnRowOMiVIZveRVn-rw@comcast.com...
> "Bradley" <bradley@tailormadeit.co.uk> wrote in message
> news:umwg#ZLpFHA.2952@TK2MSFTNGP15.phx.gbl...
>> "McKirahan" <News@McKirahan.com> wrote in message
>> news:Ne2dnYccXcepIpjeRVn-tg@comcast.com...
>> > "Bradley" <bradley@tailormadeit.co.uk> wrote in message
>> > news:unDrsdKpFHA.3064@TK2MSFTNGP15.phx.gbl...
>> >
>> > [snip]
>> >
>> >> Hi McKirahan
>> >>
>> >> That's amazing, I haven't a clue what it all means, but it creates a
> log
>> >> file error
>> >>
>> >> 19/08/2005 11:11:09 : STUDY = Failed!
>> >>
>> >> Am I supposed to change something
>> >>
>> >> Regards
>> >>
>> >> Bradley
>> >>
>> >
>> > One of these four conditions failed:
>> >
>> > objFSO.FolderExists("p:\cmanger\STUDY\Dailydoc")
>> > objFSO.FolderExists("p:\cmanger\STUDY\Dailydoc")
>> > Not objFSO.FolderExists("p:\cmanger\backup\DailyDoc\20050819")
>> > Not objFSO.FolderExists("p:\cmanger\backup\DailyImg\20050819")
>> >
>> > The first two folders must exist; the second two folders shouldn't
> exist.
>> >
>> >
>> > Or did you want the backups to go to the following folders?
>> >
>> > p:\cmanger\backup\20050819\DailyDoc
>> > p:\cmanger\backup\20050819\DailyImg
>> >
>> >
>>
>> Hi McKirahan
>>
>> I notice that my folder is called "CManager" not CManger, so I amended
>> the
>> lines
>>
>> Const cVBS = "pcmanager.vbs"
>> Const cLOG = "pcmanager.log"
>> Const cFR1 = "p:\cmanager\?\Dailydoc"
>> Const cFR2 = "p:\cmanager\?\DailyImg"
>> Const cTO1 = "p:\cmanager\backup\DailyDoc\?"
>> Const cTO2 = "p:\cmanager\backup\DailyImg\?"
>> Const cWSS = "COMPUTERNAME"
>>
>> Then I got a Windows Script Host message...
>>
>> Script: C:\Documents and Settings\Bradley\Desktop\copyscan.vbs
>> Line: 60
>> Char: 9
>> Error: Path not found
>> Code: 800A004C
>> Source: Microsoft VBScript runtime error
>>
>> So I created the folders "p:\cmanager\backup\DailyDoc" &
>> "p:\cmanager\backup\DailyImg" and it worked great.
>>
>> Therefore could the script automatically create these folders
>> "backup\DailyDoc" & "backup\DailyImg" if they don't exist.
>>
>> It's amazing how such a little thing can bring so much joy, I was amazed
>> when it worked. You probably think it part of the norm but I thought it
>> amazing.
>>
>> Regards
>>
>> Bradley
>>
>
> Try this:
>
> '*
> '* Create Backup Folders
> '*
> strTO1 = Replace(cTO1,"\?","")
> strTO2 = Replace(cTO2,"\?","")
> If Not objFSO.FolderExists(strTO1) Then
> objFSO.CreateFolder strTO1
> End If
> If Not objFSO.FolderExists(strTO2) Then
> objFSO.CreateFolder strTO2
> End If
> '*
> '* Workstation Name (e.g. "COMPUTERNAME=ABC123" )
> '*
>
> Of course, the folder:
> "p:\cmanager\backup"
> must already exist for the above to work.
>
>
Hi McKirahan

Thanks for the reply

I pasted the new section after the Declare Objects section just before "Copy
Files (w/ overwrite) the Delete Files"
However I get a Windows Script Host error
Path not found on line 60 char 9 which is "objFSO.CreateFolder strTO1"

What am I doing wrong?



Re: Copying Folder Contents by McKirahan

McKirahan
Sat Aug 20 07:08:41 CDT 2005

"Bradley" <bradley@tailormadeit.co.uk> wrote in message
news:eLEJ9AWpFHA.3064@TK2MSFTNGP15.phx.gbl...

[snip]

> > Try this:
> >
> > '*
> > '* Create Backup Folders
> > '*
> > strTO1 = Replace(cTO1,"\?","")
> > strTO2 = Replace(cTO2,"\?","")
> > If Not objFSO.FolderExists(strTO1) Then
> > objFSO.CreateFolder strTO1
> > End If
> > If Not objFSO.FolderExists(strTO2) Then
> > objFSO.CreateFolder strTO2
> > End If
> > '*
> > '* Workstation Name (e.g. "COMPUTERNAME=ABC123" )
> > '*
> >
> > Of course, the folder:
> > "p:\cmanager\backup"
> > must already exist for the above to work.
> >
> >
> Hi McKirahan
>
> Thanks for the reply
>
> I pasted the new section after the Declare Objects section just before
"Copy
> Files (w/ overwrite) the Delete Files"
> However I get a Windows Script Host error
> Path not found on line 60 char 9 which is "objFSO.CreateFolder strTO1"
>
> What am I doing wrong?
>

I indicated that it should go before:

'*
'* Workstation Name (e.g. "COMPUTERNAME=ABC123" )
'*

If that doesn't fix it then post your code and identifythe line in error.


Another thing to try would be to remove the back slashes; change:
strTO1 = Replace(cTO1,"\?","")
strTO2 = Replace(cTO2,"\?","")
to
strTO1 = Replace(cTO1,"?","")
strTO2 = Replace(cTO2,"?","")




Re: Copying Folder Contents by Bradley

Bradley
Sat Aug 20 07:38:29 CDT 2005

I have enclosed the whole script below, the error message is;
Windows Script Host
Line: 46
Char: 9
Error: Path not found
Code: 800A004C
Source: Microsoft VBScript runtime error
***********************************************

Option Explicit
'*
'* Declare Constants
'*
Const cVBS = "pcmanager.vbs"
Const cLOG = "pcmanager.log"
Const cFR1 = "p:\cmanager\?\Dailydoc"
Const cFR2 = "p:\cmanager\?\DailyImg"
Const cTO1 = "p:\cmanager\backup\DailyDoc\?"
Const cTO2 = "p:\cmanager\backup\DailyImg\?"
Const cWSS = "COMPUTERNAME"
'*
'* Declare Variables
'*
Dim strFR1 '= FROM folder #1
Dim strFR2 '= FROM folder #2
Dim strMSG '= Message
Dim strNOW '= Current Date+Time
strNOW = Now
Dim strSFN '= Script Full Name's Folder
strSFN = WScript.ScriptFullName
strSFN = Left(strSFN,InStrRev(strSFN,"\"))
Dim strTO1 '= TO folder #1
Dim strTO2 '= TO folder #2
Dim strWKS '= Workstation
Dim strWSS '= Environment
Dim strYMD '= YYYYMMDD
strYMD = DatePart("yyyy",strNOW)
strYMD = strYMD & Right(100+DatePart("m",strNOW),2)
strYMD = strYMD & Right(100+DatePart("d",strNOW),2)
'*
'* Declare Objects
'*
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objOTF
Set objOTF = objFSO.OpenTextFile(strSFN & cLOG,8,True)
Dim objWSS
Set objWSS = CreateObject("WScript.Shell")
'*
'* Create Backup Folders
'*
strTO1 = Replace(cTO1,"?","")
strTO2 = Replace(cTO2,"?","")
If Not objFSO.FolderExists(strTO1) Then
objFSO.CreateFolder strTO1
End If
If Not objFSO.FolderExists(strTO2) Then
objFSO.CreateFolder strTO2
End If
'*
'* Workstation Name (e.g. "COMPUTERNAME=ABC123" )
'*
For Each strWSS in objWSS.Environment("Process")
If Left(strWSS,Len(cWSS)) = cWSS Then
strWKS = Mid(strWSS,Len(cWSS)+2)
End If
Next
strFR1 = Replace(cFR1,"?",strWKS)
strFR2 = Replace(cFR2,"?",strWKS)
strTO1 = Replace(cTO1,"?",strYMD)
strTO2 = Replace(cTO2,"?",strYMD)
strMSG = strWKS & " = "
'*
'* Copy Files (w/ overwrite) the Delete Files
'*
If objFSO.FolderExists(strFR1) _
And objFSO.FolderExists(strFR2) _
And Not objFSO.FolderExists(strTO1) _
And Not objFSO.FolderExists(strTO2) Then
objFSO.CreateFolder strTO1
objFSO.CopyFile strFR1 & "\*.*", strTO1, True
objFSO.DeleteFile strFR1 & "\*.*", True
objFSO.CreateFolder strTO2
objFSO.CopyFile strFR2 & "\*.*", strTO2, True
objFSO.DeleteFile strFR2 & "\*.*", True
strMSG = "Archive successful!"
Else
strMSG = "Failed!"
End If
objOTF.WriteLine(strNOW & " : " & strWKS & " = " & strMSG)
'*
'* Destroy Objects
'*
Set objFSO = Nothing
Set objOTF = Nothing
Set objWSS = Nothing
'*
'* Display Message
'*
MsgBox strMSG,VBInformation,cVBS



Re: Copying Folder Contents by Dr

Dr
Sat Aug 20 09:05:32 CDT 2005

JRS: In article <s6ydncgAONMj1JjeRVn-qg@comcast.com>, dated Thu, 18 Aug
2005 21:52:54, seen in news:microsoft.public.scripting.vbscript,
McKirahan <News@McKirahan.com> posted :

> Dim strYMD '= YYYYMMDD
> strYMD = DatePart("yyyy",strNOW)
> strYMD = strYMD & Right(100+DatePart("m",strNOW),2)
> strYMD = strYMD & Right(100+DatePart("d",strNOW),2)

Dim strYMD '= YYYYMMDD
strYMD = Year(strNOW)*10000 + Month(strNOW)*100 + Day(strNOW)

And strNOW is not, and should not be, a string, although it is named as
if it were.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.

Re: Copying Folder Contents by Bradley

Bradley
Sat Aug 20 11:40:26 CDT 2005

"Dr John Stockton" <jrs@merlyn.demon.co.uk> wrote in message
news:YIA6eqIsizBDFwNZ@merlyn.demon.co.uk...
> JRS: In article <s6ydncgAONMj1JjeRVn-qg@comcast.com>, dated Thu, 18 Aug
> 2005 21:52:54, seen in news:microsoft.public.scripting.vbscript,
> McKirahan <News@McKirahan.com> posted :
>
>> Dim strYMD '= YYYYMMDD
>> strYMD = DatePart("yyyy",strNOW)
>> strYMD = strYMD & Right(100+DatePart("m",strNOW),2)
>> strYMD = strYMD & Right(100+DatePart("d",strNOW),2)
>
> Dim strYMD '= YYYYMMDD
> strYMD = Year(strNOW)*10000 + Month(strNOW)*100 + Day(strNOW)
>
> And strNOW is not, and should not be, a string, although it is named as
> if it were.
>
> --
> © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00
> MIME. ©
> Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links,
> acronyms
> PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see
> 00index.htm
> Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm
> etc.

Yes that worked as well!
But do you know where I should enter the create folder section or how to get
the script to automatically create the folders if they don't exist.

Bradley