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

Visual Basic

 
QuestionOrganize files by modified date into folders \\year\month\file.doc Pin
MatthewStLawrence13-Aug-09 7:46
MatthewStLawrence13-Aug-09 7:46 
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 
I created a few sample text files with the name
smith john -19850615.txt

just to see if the code would work...

now when I hit open on the open file dialog, it just sits there.

<br />
Imports System.IO<br />
Public Class Form1<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
OpenFileDialog1.ShowDialog()<br />
 <br />
End Sub<br />
 <br />
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk<br />
Dim oldpath As String<br />
Dim length As Integer<br />
Dim year As String<br />
Dim month As String<br />
Dim newpath As String<br />
Dim start As Int32 'start of year in string<br />
Dim start2 As Int32 'start of month in string<br />
Dim start3 As Int32 'start of filename in string<br />
Dim newpathfull As String<br />
 <br />
For Each S As String In OpenFileDialog1.FileNames<br />
'oldpath = S<br />
'gets length of filename<br />
length = S.Length<br />
'Pulls year from last 12 digits of filename<br />
start = length - 12<br />
year = S.Substring(start, 4)<br />
'Pulls the month from the filename<br />
start3 = length - 8<br />
start2 = S.LastIndexOf("\")<br />
month = S.Substring(start3, 2)<br />
newpath = "C:\PP\"<br />
newpathfull = year & "\" & month & "\" & 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, newpath)<br />
Else<br />
System.IO.Directory.CreateDirectory(newpath & year)<br />
System.IO.Directory.CreateDirectory(newpath & year & month)<br />
End If<br />
Next<br />
 <br />
 <br />
 <br />
End Sub<br />
End Class<br />

AnswerRe: Organize files by modified date into folders \\year\month\file.doc Pin
MatthewStLawrence17-Aug-09 12:17
MatthewStLawrence17-Aug-09 12:17 
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 

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.