How can I select directories with in a date range - 14 days.

I am trying to zip up multiple directories that are named in 20150716 format for every day of the year - 14 Days when the application is run. It will then take the zip file and upload it to a ftp server. I have the code done for the zipping of some other files and upload it up the ftp server. But I am having trouble coming up with the code for the Directories.

I dont want it to individual zip each directory as much as zip to the current day - 14 days.

Is this possible if so can I get a code example.

I am using Visual Basic 2013.

Thanks,

Current example of the code below
Imports System.IO.Compression ' Declaring refrences
Imports System.IO ' Declaring refrences
Imports System.Web
Imports System.Net.Mail

Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Try
Dim startPath1 As String = "D:\Bootdrv\AlohaQS\DATA\" ' Setting the DATA Folder For Zipping
Dim startPath2 As String = "D:\Bootdrv\AlohaQS\NEWDATA\" ' Setting the NEWDATA Folder for Zipping
Dim zipPath1 As String = "D:\Bootdrv\AlohaQS\WILL_DATA.zip" ' Nameing the Backup ZIP
Dim zipPath2 As String = "D:\Bootdrv\AlohaQS\WILL_NEWDATA.ZIP" 'Nameing the Back up ZIP



ZipFile.CreateFromDirectory(startPath1, zipPath1)
ZipFile.CreateFromDirectory(startPath2, zipPath2)

Dim myFTPaddress As String = "ftp server" ' ftp server
Dim myFTPuserName As String = "username" ' ftp username
Dim myFTPuserPassword As String = "password" 'ftp password
Dim myFiles() As String = {"D:\Bootdrv\AlohaQS\WILL_DATA.ZIP", "D:\Bootdrv\AlohaQS\WILL_NEWDATA.ZIP"} '// files for Uploading
Dim sTemp As String = Nothing '// used to extract only FileName with Extenstion.
For Each mySelectedFile As String In myFiles '// loop thru your files.
sTemp = IO.Path.GetFileName(mySelectedFile) '// get only the file name with extension from Full Path.
'// upload File to website.
My.Computer.Network.UploadFile(mySelectedFile, myFTPaddress & sTemp, myFTPuserName, myFTPuserPassword)
Next
Dim thisDate As Date
thisDate = Today
My.Computer.FileSystem.WriteAllText("D:\Bootdrv\AlohaQS\TMP\FTPBackupDebout.txt", "thisDateFTP Back Up Completed Successfully", True) 'Writes to the debout that it was successful
Me.Close()

Catch
Dim thisDate As Date
thisDate = Today
My.Computer.FileSystem.WriteAllText("D:\Bootdrv\AlohaQS\TMP\FTPBackupDebout.txt", "thisDateFTP Back Up was not Successfully", True) ' Write to the debout the upload failed
Me.Close()
End Try







End Sub
End Class
 

Open in new window


I have also tried the following.
Try
Dim startPath1 As String = "D:\Bootdrv\AlohaQS\DATA\" ' Setting the DATA Folder For Zipping
Dim startPath2 As String = "D:\Bootdrv\AlohaQS\NEWDATA\" ' Setting the NEWDATA Folder for Zipping
Dim zipPath1 As String = "D:\Bootdrv\AlohaQS\WILL_DATA.zip" ' Nameing the Backup ZIP
Dim zipPath2 As String = "D:\Bootdrv\AlohaQS\WILL_NEWDATA.ZIP" 'Nameing the Back up ZIP
Dim objCurrentDate As Date = DateAdd(-14, , date) As Date
If objCurrentdate = True Then

End If

 

Open in new window


although I was never able to get that to work as it was always saying it was not declared.
Fradojr88Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gautham JanardhanCommented:
use file info to get the dates

Dim information = My.Computer.FileSystem.GetFileInfo(giveFileFullPathHere)
MsgBox("Last access time is " & information.LastAccessTime & ".")

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fradojr88Author Commented:
I was able to get the information with this command. I actually had another question when I reworded it to get the answer. Thanks for your information as being the only person to answer it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.