Re: Scripting: Zipping files and checking Network Share
- From: "Tim Williams" <timjwilliams at gmail dot com>
- Date: Thu, 27 Nov 2008 13:17:18 -0800
Zipping:
http://www.rondebruin.nl/windowsxpzip.htm
Tim
"Chris" <Chris@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:618687AA-5EF6-4E7D-BDFD-1089131CD70A@xxxxxxxxxxxxxxxx
Community,
First off, have done some VB.Net programming - but am in No way an expert.
I
probably forgot 80% of it since i do not use it often.
I am trying to write a script (fun so far!) that performs a few specific
tasks. I'm looking for some pointers, reference sites that can help me
with
the following items:
Task 1
Copy source files to destination only if they do not exsist on the
destination drive.
(completed)
Task 2
create a zip file in MMM-YYYY.zip, check date of file (prob. created date)
and move the file to the archive. However, I do not want to copy files
created the same day the script is running. So, if Nov-2008.zip was
created
- all files for the month of November get moved into the archive. This
script
will run several times a day.
Task 3
The script is going to be running on the destination machine. Using
network
shares, but do not want to map a drive. I want the script to check for
connectivity to the source drive. Once I have this - I think I can figure
out how to have it loop until a successful connection is made - and send
out
e-mail alerts if unable to establish a connection after x many tries or
some
sort of counter value.
Here is what I have thus far:
' Purpose:
' Check Source and Destination. If source has a file that destination
does
not, copy source to destination. One-way Sync
' In Source: Create a zip container for the current month/year (MMM-YYYY)
and move files made in that time frame
' to that zip container - do not include files generated on the same day
the script is running.
' Require Error checking (first for network connectivity, than file
copying) Notify by e-mail on all errors and continue loop until network
' connection is made.
'
' Duration: Script to run Hourly, Monday through Friday
'
Dim objFilesys,Folder,objMessage,srcFolder,dstFolder,srcFile,objShell
srcFolder ="\\wrkstation-ip\Greefa_Data\"
dstFolder ="\\server-ip\common\Intake and Processing
Division\Pre-Sort\Greefa_Data\"
Set objFilesys = CreateObject("Scripting.FileSystemObject")
Set objShell = Wscript.CreateObject("Wscript.Shell")
CopySource()
WScript.Quit
'Copies the Source to Destination, minor error checking
Sub CopySource()
For Each srcFile in objFilesys.GetFolder(srcFolder).Files
If Not objFilesys.FileExists(dstFolder &
objFilesys.GetFilename(srcFile)) Then
objFilesys.GetFile(srcFile).Copy dstFolder &
objFilesys.GetFilename(srcFile),False
Else
Msgbox(srcFile & " File Exists")
End If
Next
End Sub
Sub MonthlyZip()
objShell.Exec(...)
' Thinking of using 7zip if I cannot figure out how to use native Win2k3
zip
End Sub
Any suggestions?
.
- References:
- Prev by Date: Re: pwdLastSet chnge value
- Next by Date: Re: Execute command line switches from vbs
- Previous by thread: Scripting: Zipping files and checking Network Share
- Index(es):
Relevant Pages
|
Loading