Hi Folks,
Is there a way to ignore links / aliases when parsing a Windows directory structure? I’ve tried using “If Not f.Alias Then” to wrap things, but the links are still being added to the list I’m building.
Thanks,
Tim
Hi Folks,
Is there a way to ignore links / aliases when parsing a Windows directory structure? I’ve tried using “If Not f.Alias Then” to wrap things, but the links are still being added to the list I’m building.
Thanks,
Tim
use trueChild/trueItem to get the real files.
I know how to do that - what I want to do is to ignore entries in the folder that are Aliases / Symlinks. Logic says that:
If f.Item(x).Alias Then
// ignore this item
Else
// Do stuff with folder item
End If
Should give me what I need, but the items that should be aliases keep showing up.
While it may not be “correct” this
If Right(f.TrueItem(i).NativePath, 3) <> "lnk" Then
// Ignore this Item
Else
// List it
End If
Works for Windows. Obviously there’s something wrong under the hood, but it’s a work around.
Thanks, Wayne. That solved my conundrum. I agree that it shouldn’t be required, but maybe a .lnk file is not being recognized as an alias with the Xojo FolderItem class…
Tim
Correction - something’s still not right. If I do a “DIR /A:H” on one of the directories, the files giving me fits are files, not symlinks…
Hey @Charles Yeomans - anything in WFS that might identify these entries?
[quote=70326:@Wayne Golding]While it may not be “correct” this
If Right(f.TrueItem(i).NativePath, 3) <> "lnk" Then
// Ignore this Item
Else
// List it
End If
Works for Windows. Obviously there’s something wrong under the hood, but it’s a work around.[/quote]
That is the correct way to do it. There is nothing “wrong under the hood.” TrueItem is the pre-resolved file (the shortcut). Item is always post-resolved - what the shortcut points to.
What is a “Junction” file?
A Junction file is the filetype that NTFS assigns to the “name” that is displayed in explorer.
i.e.: - My Documents is a JUNCTION that points to the real folder “Documents” and Documents is hidden.
11/20/2013 02:30 PM <DIR> AppData
11/20/2013 02:30 PM <JUNCTION> Application Data [C:\\Users\\Tim\\AppData\\Roaming]
11/20/2013 02:30 PM <JUNCTION> Cookies [C:\\Users\\Tim\\AppData\\Local\\Microsoft\\Windows\\INetCookies]
11/20/2013 02:30 PM <JUNCTION> Local Settings [C:\\Users\\Tim\\AppData\\Local]
11/20/2013 02:30 PM <JUNCTION> My Documents [C:\\Users\\Tim\\Documents]
11/20/2013 02:30 PM <JUNCTION> NetHood [C:\\Users\\Tim\\AppData\\Roaming\\Microsoft\\Windows\etwork Shortcuts]
This also means that the f.Item(x).NativePath is not correct. According to FolderItem’s info:
2014-03-10 11:55:01: WMain.lbBackupPaths.ExpandRow: Application Data, False or C:\\Users\\Tim\\Application Data\\
2014-03-10 11:55:01: WMain.lbBackupPaths.ExpandRow: Contacts, True or C:\\Users\\Tim\\Contacts\\
2014-03-10 11:55:01: WMain.lbBackupPaths.ExpandRow: Cookies, False or C:\\Users\\Tim\\Cookies\\
2014-03-10 11:55:01: WMain.lbBackupPaths.ExpandRow: Desktop, True or C:\\Users\\Tim\\Desktop\\
2014-03-10 11:55:01: WMain.lbBackupPaths.ExpandRow: Development, True or C:\\Users\\Tim\\Development\\
2014-03-10 11:55:01: WMain.lbBackupPaths.ExpandRow: Documents, True or C:\\Users\\Tim\\Documents\\
In that example, C:\Users\Tim\Application Data\ should actually point to C:\Users\Tim\AppData\.
The other interesting thing according to MSDN is that a JUNCTION should also be HIDDEN and SYSTEM and it’s not according to the Xojo FolderItem info about the TrueItem. While checking the Visible attribute does hide the JUNCTIONS, it also hides other paths that I do need to display.