Solved

Differentiate between Directory Link and Directory

Posted on 2011-09-06
2
704 Views
Last Modified: 2012-08-13
Hi,

'My Documents' is shown as a Folder in Win7 since it is a Directory Link. In findfirst I want to be able to differentiate between a propoer Folder and a
Directory link. I use Delphi 2007 on Win7.

Regards
Allan
0
Comment
Question by:Allan_Fernandes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 37

Accepted Solution

by:
Geert Gruwez earned 500 total points
ID: 36493967
i can find the file with this code:
procedure TfrmTestEE.Button1Click(Sender: TObject);
var sr: TSearchRec;
  procedure AddFile;
  begin
    Memo1.Lines.Add(Format('%s : %x', [sr.Name, sr.Attr]));
  end;
begin
  if FindFirst('c:\Users\Default\MYDOCU~1', faHidden + faSysFile + faSymLink + faDirectory, sr) = 0 then
  try
    AddFile;
    while FindNext(sr) = 0 do
      AddFile;
  finally
    FindClose(sr);
  end;
end;

Open in new window


output:
My Documents : 2416

By checking the attributes i can see the symbolic link:
>  faHidden    = $00000002 platform;
> faSysFile   = $00000004 platform;
>  faDirectory = $00000010;

so far the parameters we know about ...
The 2 and 4 are in this list:
http://msdn.microsoft.com/en-us/library/system.io.fileattributes.aspx
0400: ReparsePoint
2000: NotContentIndexed

So you are looking for files with attr: Attr and $0400 = $0400

{ File attribute constants }

  faReadOnly  = $00000001 platform;
  faHidden    = $00000002 platform;
  faSysFile   = $00000004 platform;
  faVolumeID  = $00000008 platform deprecated;  // not used in Win32
  faDirectory = $00000010;
  faArchive   = $00000020 platform;
  faSymLink   = $00000040 platform;
  faNormal    = $00000080 platform;
  faTemporary = $00000100 platform;
  faAnyFile   = $000001FF;

Open in new window

0
 

Author Closing Comment

by:Allan_Fernandes
ID: 36502111
So do you do mind reading too ?
You answered my other queries too.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question