- #1
Time Traveler
- 4
- 0
I've been trying to figure this out for the past couple of days but I'm at a complete lost on it. I know I'm missing something or mayby it just can't be done but how can I loop over a set of files as seen in part of the script below instead of changing the file name manually?
I have a couple hundred files that I want to analyze but I don't want to have to change the time and month in the file name manually by editing the script after each run. I though something along the lines of what I have below would work but apperently it's not. Please note that I'm relatively new at Visual Basic so any imput would be appreciated.
Dim File As String
Dim File1 As String
Dim File2 As String
Dim File3 As String
Dim File4 As String
Dim Mth As Integer
Dim Tim As Integer
For Mth = 03 To 10 Step 1
For Tim = 17 To 22 Step 1
File = SurferApp.Path + "\Summer Project\data\2003"
File1 = File + "\diff\diff_2003_Mth_Tim"
File2 = File + "\Images\diff_2003_Mth_Tim"
File3 = File + "\Surfer Files\diff_2003_Mth_Tim"
File4 = File + "\Grid Files\diff_2003_Mth_Tim"
......
Next Tim
Next Mth
I should also note that the script works fine when I execute it one day at a time ... it does exactly what i want it to do ... it's only looping over all the files automatically that won't work.
I have a couple hundred files that I want to analyze but I don't want to have to change the time and month in the file name manually by editing the script after each run. I though something along the lines of what I have below would work but apperently it's not. Please note that I'm relatively new at Visual Basic so any imput would be appreciated.
Dim File As String
Dim File1 As String
Dim File2 As String
Dim File3 As String
Dim File4 As String
Dim Mth As Integer
Dim Tim As Integer
For Mth = 03 To 10 Step 1
For Tim = 17 To 22 Step 1
File = SurferApp.Path + "\Summer Project\data\2003"
File1 = File + "\diff\diff_2003_Mth_Tim"
File2 = File + "\Images\diff_2003_Mth_Tim"
File3 = File + "\Surfer Files\diff_2003_Mth_Tim"
File4 = File + "\Grid Files\diff_2003_Mth_Tim"
......
Next Tim
Next Mth
I should also note that the script works fine when I execute it one day at a time ... it does exactly what i want it to do ... it's only looping over all the files automatically that won't work.
Last edited: