?
Solved

Differentiate between Directory Link and Directory

Posted on 2011-09-06
2
Medium Priority
?
708 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 38

Accepted Solution

by:
Geert Gruwez earned 2000 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

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…
The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Suggested Courses

771 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