VBA to backup and zip a file

Amnross

New member
Local time
, 18:47
Joined
Jun 3, 2013
Messages
5
I have a block of code that I use as a backup function to move files between my server drive and my local drive. Our network guys told us last week that we were no longer allowed to keep out outlook pst file on our server drives. As I spend a great deal of time away from my office, I need access to my pst. I would like to take my current block of code and modify it to transfer my local computer pst file to my server drive and convert it into a zip file so it won't be deleted from the server. I've tried several methods of conversion, but most require zipmods that are installed outside of the basic windows install that I'm not allowed to install. :banghead:

Code:
'This example copies all files and subfolders from FromPath to ToPath.
'Note: If ToPath already exist it will overwrite existing files in this folder
'if ToPath not exist it will be made for you.    
    Dim FSO As Object
    Dim FromPath As String
    Dim ToPath As String
    FromPath = "SERVER DRIVE"
    ToPath = "LOCAL DRIVE\" & Format(Now, "yyyy-mm-dd h-mm-ss")
'If you want to create a backup of your folder every time you run this macro
'you can create a unique folder with a Date/Time stamp.
'ToPath = "C:\Users\Ron\" & Format(Now, "yyyy-mm-dd h-mm-ss")
    If Right(FromPath, 1) = "\" Then
        FromPath = Left(FromPath, Len(FromPath) - 1)
    End If
    If Right(ToPath, 1) = "\" Then
        ToPath = Left(ToPath, Len(ToPath) - 1)
    End If
    Set FSO = CreateObject("scripting.filesystemobject")
    If FSO.FolderExists(FromPath) = False Then
        MsgBox FromPath & " doesn't exist"
        Exit Sub
    End If
    FSO.CopyFolder Source:=FromPath, Destination:=ToPath
    MsgBox "You can find the files and subfolders from " & FromPath & " in " & ToPath
End Sub
 
Just curious - if you work in a department or organization with several people and Outlook is you "corporate" email , and possible task/meeting scheduling software, how do you corporately manage emails and related backups? Seems to me they would want .pst on server and include backups/compressions etc on a formal schedule.

I'm interested in the rationale for no pst on server -- but maybe I'm not interpreting your message correctly.
 
Our tech guys don't need a rationale for what they do, but the running theory is they want to reduce the amount of static data on the network servers. The org that I work for has several 100k employees, so I understand where they are coming from. My archived pst is on the order of 2-3 gigs right now but I keep that on the local drive and back up with DVDs. I only want to have access to about a months worth of email. After that, I transfer them into the archive, which I don't need ready access to.
 
An organization that big has probably a number of SANs.

You must have some corporate email policy for legal concerns if nothing else. You may even be subject to some degree to "Access to Information legislation" or other.

Our tech guys don't need a rationale for what they do
really -- they may think that, but the lawyers and finance (and shareholders) may have a different story.
There are not many viable, competitive companies without formal backup systems --knowingly. I'm sure there are many who believe they are backing up regularly; have established restore and recovery tests;-- but have not put the "system" to the test.

From my view, any of your company based (non-personal) emails should be subject to your records management practices and backed up via formal procedures. This is not the jurisdiction of a few IT guys.

Do you really not have a SAN or cartridge storage vaults or offsite backups?
 
While I don't disagree and there are procedures for offsite backups, it is very time consuming to recover "lost" information thru our current system. All I'm looking for out of this forum is some assistance with moding my code to convert files into a zip format. I would be happy to discuss our network issues in a network architecture forum at a later date.
 

Users who are viewing this thread

Back
Top Bottom