[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Differentiate between Directory Link and Directory

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Log files are useful in diagnosing and repairing problems.  This is a list of common log files and their standard locations that I've compiled.   While this is not exhaustive, it is a pretty good list that I've found to be useful.  I may update it f…
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…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
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…
Suggested Courses

656 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