I found the following script, which by the way is a fantastic script and
props to the one that wrote it. But I need it to do a little more for me. I
need the script to copy the folder not just the files inside that folder.
IE copy C:\Scripts to D:\Backup\â??folder created from scriptâ??\Scripts

I also need to be able to specify multiple folders to copy like C:\Scripts,
C:\Extras and so forth. Now I do not have to do this by any means it would
just be nice to not have to create a new script for every one of the 6 to 8
folders this will run for.

I modified it again and again to what I think it should be but cannot figure
it out getting a script error every time. So here is the original script
change so that it copyâ??s not moves the files. Every time I modify it I get an
error on line 57. I just cannot figure it out after 2 days of screwing with
it. By the way i am very new at this and have no formal training, just what i
learn for reading these newgroups.

Thanks for the help if any one is able or want's to.

'''''''''''''''''''''''''''''''''''''''''''''''
'New code to copy to unique date stamped folder
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'''''''''''''''''''''''''''''''''''''''''''''''
'Option Explicit

' Create the File System Object
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")

Dim errorFolder
errorFolder = "F:\New"

Dim ef
Set ef = FSO.GetFolder(errorFolder)


''''''''''''''''''''''''''''''''''''''
'Create Unique Destination Folder
''''''''''''''''''''''''''''''''''''''
Dim datetoday, timetoday
Dim strMonth, strDay, strHour, strMinute, strSecond
Dim strDirectory
datetoday = now
strMonth = Month(datetoday)
strDay = Day(datetoday)
strHour = Hour(datetoday)
strMinute = Minute(datetoday)
strSecond = Second(datetoday)
if len(strMonth) = 1 then
strMonth = "0" & strMonth
end if
if len(strDay) = 1 then
strDay = "0" & strDay
end if
if len(strHour) = 1 then
strHour = "0" & strHour
end if
if len(strMinute) = 1 then
strMinute = "0" & strMinute
end if
if len(strSecond) = 1 then
strSecond = "0" & strSecond
end if
datetoday = YEAR(datetoday) & strMonth & strDay
timetoday = strHour & strMinute & strSecond
strDirectory = "F:\Backup\" & datetoday & "_" & timetoday & " Production"
FSO.CreateFolder(strDirectory)



Dim f

For Each f in ef.Files

' Copy the file to the archive folder

FSO.CopyFile f, strDirectory & "\"

Next


--
Thanks
TimM

RE: Copy folder to time stamped folder. by TimM

TimM
Mon Nov 13 21:22:01 CST 2006

Well never mind i figured it out on my own, kinda. Now i just have to figure
out of to compress the output folder and log every file copied to a text
file, joy.

Thanks anyways I know every one is normally always helpfull around here.

Tim

Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")


Dim datetoday, timetoday
Dim strMonth, strDay, strHour, strMinute, strSecond
Dim strDirectory
datetoday = now
strMonth = Month(datetoday)
strDay = Day(datetoday)
strHour = Hour(datetoday)
strMinute = Minute(datetoday)
strSecond = Second(datetoday)
if len(strMonth) = 1 then
strMonth = "0" & strMonth
end if
if len(strDay) = 1 then
strDay = "0" & strDay
end if
if len(strHour) = 1 then
strHour = "0" & strHour
end if
if len(strMinute) = 1 then
strMinute = "0" & strMinute
end if
if len(strSecond) = 1 then
strSecond = "0" & strSecond
end if
datetoday = YEAR(datetoday) & strMonth & strDay
timetoday = strHour & strMinute & strSecond
strDirectory = "E:\Backup\" & datetoday & "_" & timetoday & " Full"
FSO.CreateFolder(strDirectory)


Const OverWriteFiles = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder "c:\Database" , strDirectory & "\" , OverWriteFiles
--
Thanks
TimM


"TimM" wrote:

> I found the following script, which by the way is a fantastic script and
> props to the one that wrote it. But I need it to do a little more for me. I
> need the script to copy the folder not just the files inside that folder.
> IE copy C:\Scripts to D:\Backup\â??folder created from scriptâ??\Scripts
>
> I also need to be able to specify multiple folders to copy like C:\Scripts,
> C:\Extras and so forth. Now I do not have to do this by any means it would
> just be nice to not have to create a new script for every one of the 6 to 8
> folders this will run for.
>
> I modified it again and again to what I think it should be but cannot figure
> it out getting a script error every time. So here is the original script
> change so that it copyâ??s not moves the files. Every time I modify it I get an
> error on line 57. I just cannot figure it out after 2 days of screwing with
> it. By the way i am very new at this and have no formal training, just what i
> learn for reading these newgroups.
>
> Thanks for the help if any one is able or want's to.
>
> '''''''''''''''''''''''''''''''''''''''''''''''
> 'New code to copy to unique date stamped folder
> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> '''''''''''''''''''''''''''''''''''''''''''''''
> 'Option Explicit
>
> ' Create the File System Object
> Dim FSO
> Set FSO = CreateObject("Scripting.FileSystemObject")
>
> Dim errorFolder
> errorFolder = "F:\New"
>
> Dim ef
> Set ef = FSO.GetFolder(errorFolder)
>
>
> ''''''''''''''''''''''''''''''''''''''
> 'Create Unique Destination Folder
> ''''''''''''''''''''''''''''''''''''''
> Dim datetoday, timetoday
> Dim strMonth, strDay, strHour, strMinute, strSecond
> Dim strDirectory
> datetoday = now
> strMonth = Month(datetoday)
> strDay = Day(datetoday)
> strHour = Hour(datetoday)
> strMinute = Minute(datetoday)
> strSecond = Second(datetoday)
> if len(strMonth) = 1 then
> strMonth = "0" & strMonth
> end if
> if len(strDay) = 1 then
> strDay = "0" & strDay
> end if
> if len(strHour) = 1 then
> strHour = "0" & strHour
> end if
> if len(strMinute) = 1 then
> strMinute = "0" & strMinute
> end if
> if len(strSecond) = 1 then
> strSecond = "0" & strSecond
> end if
> datetoday = YEAR(datetoday) & strMonth & strDay
> timetoday = strHour & strMinute & strSecond
> strDirectory = "F:\Backup\" & datetoday & "_" & timetoday & " Production"
> FSO.CreateFolder(strDirectory)
>
>
>
> Dim f
>
> For Each f in ef.Files
>
> ' Copy the file to the archive folder
>
> FSO.CopyFile f, strDirectory & "\"
>
> Next
>
>
> --
> Thanks
> TimM