LinguaFranca
Technical User
I am a beginner in VBA, so bear with me!
I've got a project folder (of a translation tool) containing big files and the script is searching for new .big files. I then need to compare found files with the already existing files in my project folder. There is an error in my looping.
Sample files in dir:
carmen.big (new)
sea.res.big (already existing in project folder)
sea.frm.big (already existing in project folder)
I successfully find the already existing files in my project folder but when it comes to the new file which I eventually would like to import it finds carmen.big plus sea.res.big plus sea.frm.big. This because compares the dir file name with each file name in my project. They are not matching to my script but I don't know how to tweak the loop to tell read all my files in my project and if it matches once then discard the file name you are finding in the directory.
I've got a project folder (of a translation tool) containing big files and the script is searching for new .big files. I then need to compare found files with the already existing files in my project folder. There is an error in my looping.
Sample files in dir:
carmen.big (new)
sea.res.big (already existing in project folder)
sea.frm.big (already existing in project folder)
I successfully find the already existing files in my project folder but when it comes to the new file which I eventually would like to import it finds carmen.big plus sea.res.big plus sea.frm.big. This because compares the dir file name with each file name in my project. They are not matching to my script but I don't know how to tweak the loop to tell read all my files in my project and if it matches once then discard the file name you are finding in the directory.
Code:
'Tree search in subfolders
Dim fso As New FileSystemObject
Dim f As Folder, sf As Folder, fi As File
Set f = fso.GetFolder(path)
For Each sf In f.SubFolders
LoopFoldersListFiles (sf.Path)
Next
For Each fi In f.Files
strExt = LCase(Mid(fi.Path, 1+InStrRev(fi.Path,".")))
Dim prj As PslProject
Set prj=PSL.ActiveProject
Dim src As PslSourceList
If strExt = "big" Then
Dim foundFile As String
foundFile=fi.Name
'list .big files in dir structure
PSL.Output "Found file: " & foundFile
'loop through all project files
For Each src In prj.SourceLists
Dim oldFile As String
oldFile=src.Title & ".big"
'list all available .big files in project
PSL.Output oldFile
If ((foundFile=oldFile)=True) Then
PSL.Output "identical file found: " & oldFile
ElseIf ((foundFile=oldFile)=False) Then
GoTo loopBreak1
End If
Next src
loopBreak1:
If ((foundFile=oldFile)=False) Then
'final goal is to import foundFile (new) from dir here
PSL.Output "new file for import found: " & foundFile
End If
End If
Next