Hi all,
Am well and truly stumped by this one... I'm writing a file backup utility which depends on reading the contents of a bunch of folders and working out which files to copy to a backup location. Trouble is, a couple of files have "greater than / equal to" and "less than / equal to" symbols in their names, i.e. ≤ and ≥ ; when I cycle through the directory file by file using the loop below, the Dir statement returns a different name, e.g the result (strDirCheck) for the filename "ABC≤123.txt" is "ABC=123.txt", so when I then try to get the save date/time and size, I get an error:
strDirCheck = Dir(strProdDir, vbDirectory)
Do While strDirCheck <> ""
If strDirCheck <> "." And strDirCheck <> ".." Then
intFileCount = intFileCount + 1
With wksFiles.Range(strListHomeRange)
.Offset(intFileCount, 0).Value = strProdName
.Offset(intFileCount, 1).Value = strDirCheck
.Offset(intFileCount, 3).Value = FileDateTime(strProdDir & strDirCheck)
.Offset(intFileCount, 4).Value = FileLen(strProdDir & strDirCheck)
End With
End If
strDirCheck = Dir
Loop
If anyone else has seen this and has a solution, please let me know! In the meantime I'm going to see if there's a workaround...
Thanks!
Am well and truly stumped by this one... I'm writing a file backup utility which depends on reading the contents of a bunch of folders and working out which files to copy to a backup location. Trouble is, a couple of files have "greater than / equal to" and "less than / equal to" symbols in their names, i.e. ≤ and ≥ ; when I cycle through the directory file by file using the loop below, the Dir statement returns a different name, e.g the result (strDirCheck) for the filename "ABC≤123.txt" is "ABC=123.txt", so when I then try to get the save date/time and size, I get an error:
strDirCheck = Dir(strProdDir, vbDirectory)
Do While strDirCheck <> ""
If strDirCheck <> "." And strDirCheck <> ".." Then
intFileCount = intFileCount + 1
With wksFiles.Range(strListHomeRange)
.Offset(intFileCount, 0).Value = strProdName
.Offset(intFileCount, 1).Value = strDirCheck
.Offset(intFileCount, 3).Value = FileDateTime(strProdDir & strDirCheck)
.Offset(intFileCount, 4).Value = FileLen(strProdDir & strDirCheck)
End With
End If
strDirCheck = Dir
Loop
If anyone else has seen this and has a solution, please let me know! In the meantime I'm going to see if there's a workaround...
Thanks!