Click here to Skip to main content
15,903,385 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Organize files by modified date into folders \\year\month\file.doc Pin
Dave Kreskowiak13-Aug-09 8:08
mveDave Kreskowiak13-Aug-09 8:08 
GeneralRe: Organize files by modified date into folders \\year\month\file.doc Pin
MatthewStLawrence13-Aug-09 8:13
MatthewStLawrence13-Aug-09 8:13 
AnswerRe: Organize files by modified date into folders \\year\month\file.doc Pin
0x3c013-Aug-09 8:17
0x3c013-Aug-09 8:17 
AnswerRe: Organize files by modified date into folders \\year\month\file.doc Pin
Luc Pattyn13-Aug-09 9:01
sitebuilderLuc Pattyn13-Aug-09 9:01 
GeneralRe: Organize files by modified date into folders \\year\month\file.doc Pin
MatthewStLawrence13-Aug-09 9:16
MatthewStLawrence13-Aug-09 9:16 
GeneralRe: Organize files by modified date into folders \\year\month\file.doc Pin
Luc Pattyn13-Aug-09 9:21
sitebuilderLuc Pattyn13-Aug-09 9:21 
AnswerRe: Organize files by modified date into folders \\year\month\file.doc Pin
MatthewStLawrence17-Aug-09 9:49
MatthewStLawrence17-Aug-09 9:49 
AnswerRe: Organize files by modified date into folders \\year\month\file.doc Pin
MatthewStLawrence17-Aug-09 12:17
MatthewStLawrence17-Aug-09 12:17 
HERE IT IS!

I deserve a raise...

<br />
<br />
Imports System.IO<br />
Public Class Form1<br />
<br />
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
        OpenFileDialog1.ShowDialog()<br />
<br />
<br />
    End Sub<br />
<br />
<br />
    Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk<br />
<br />
        Dim oldpath As String<br />
<br />
<br />
        For Each S As String In OpenFileDialog1.FileNames<br />
            Dim length As Integer<br />
            Dim yearpath As String<br />
<br />
            Dim monthpath As String<br />
            Dim newpath As String<br />
            Dim start As Int32  'start of yearpath in string<br />
            Dim start2 As Int32 'start of monthpath in string<br />
            Dim start3 As Int32 'start of filename in string<br />
            Dim newpathfull As String<br />
<br />
            Threading.Thread.Sleep(100)<br />
<br />
            'gets length of filename<br />
            length = S.Length<br />
            'Pulls yearpath from last 12 digits of filename<br />
            start = length - 12<br />
            yearpath = S.Substring(start, 4)<br />
            'Pulls the monthpath from the filename<br />
            start3 = length - 8<br />
            start2 = S.LastIndexOf("\")<br />
            monthpath = S.Substring(start3, 2)<br />
            'new destination path<br />
            newpath = S.Substring(0, 3) & yearpath & "\" & monthpath & "\"<br />
            newpathfull = newpath & S.Substring((start2 + 1))<br />
            'checks for directory, if not there then creates it.<br />
            If (Directory.Exists(newpath)) Then<br />
                System.IO.File.Copy(S, newpathfull)<br />
            Else<br />
                System.IO.Directory.CreateDirectory(newpath)<br />
                System.IO.File.Copy(S, newpathfull)<br />
            End If<br />
<br />
        Next<br />
<br />
<br />
<br />
<br />
<br />
    End Sub<br />
End Class<br />
<br />


Thanks everyone for all your help!
QuestionHow to hook the taskbar Pin
User 584223713-Aug-09 3:51
User 584223713-Aug-09 3:51 
AnswerRe: How to hook the taskbar Pin
Dave Kreskowiak13-Aug-09 4:42
mveDave Kreskowiak13-Aug-09 4:42 
GeneralRe: How to hook the taskbar Pin
User 584223713-Aug-09 5:00
User 584223713-Aug-09 5:00 
GeneralRe: How to hook the taskbar Pin
Dave Kreskowiak13-Aug-09 6:08
mveDave Kreskowiak13-Aug-09 6:08 
QuestionExternal IP Retrieval Pin
Abhay Pratap Sikarwar13-Aug-09 2:29
Abhay Pratap Sikarwar13-Aug-09 2:29 
AnswerRe: External IP Retrieval Pin
mdrizwan_113-Aug-09 2:43
mdrizwan_113-Aug-09 2:43 
AnswerRe: External IP Retrieval Pin
Luc Pattyn13-Aug-09 3:12
sitebuilderLuc Pattyn13-Aug-09 3:12 
AnswerRe: External IP Retrieval Pin
Dave Kreskowiak13-Aug-09 4:33
mveDave Kreskowiak13-Aug-09 4:33 
QuestionFind missing Dll and ocx files? Pin
mdrizwan_113-Aug-09 1:40
mdrizwan_113-Aug-09 1:40 
AnswerRe: Find missing Dll and ocx files? Pin
Dave Kreskowiak13-Aug-09 2:09
mveDave Kreskowiak13-Aug-09 2:09 
QuestionRe: Find missing Dll and ocx files? Pin
mdrizwan_113-Aug-09 2:30
mdrizwan_113-Aug-09 2:30 
AnswerRe: Find missing Dll and ocx files? Pin
User 584223713-Aug-09 3:57
User 584223713-Aug-09 3:57 
AnswerRe: Find missing Dll and ocx files? Pin
Henry Minute13-Aug-09 4:00
Henry Minute13-Aug-09 4:00 
GeneralRe: Find missing Dll and ocx files? Pin
Luc Pattyn13-Aug-09 4:26
sitebuilderLuc Pattyn13-Aug-09 4:26 
GeneralRe: Find missing Dll and ocx files? Pin
Henry Minute13-Aug-09 4:36
Henry Minute13-Aug-09 4:36 
AnswerRe: Find missing Dll and ocx files? Pin
Dave Kreskowiak13-Aug-09 4:28
mveDave Kreskowiak13-Aug-09 4:28 
QuestionHow to avoid Designer.vb file ? Pin
Mahesh Sheka13-Aug-09 0:43
Mahesh Sheka13-Aug-09 0:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.