Solved

Differentiate between Directory Link and Directory

Posted on 2011-09-06
2
700 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

The way I use Experts Exchange to assist me in analyzing and diagnosing a problem is I first enter a Verbose Question at Experts Exchange like: Office 2007 will hang when opening and saving files I then launch WordPad (any text editor will do) an…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
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…

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now