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