How do I exclude to display Link files ?

In a ListBox, I display the contents (name of the found items) from a user selected folder and I exclude:

a. Directories
b. Files whose names start wit a dot
c. Invisible files,
d. Alias (Link) files.

While these filters set in a If …/… End If block works fine on OS X it failed miserably on Windows 10.

The used code is:

If (AnEntryFI.Directory And (Right(AnEntryFI.Name,4) <> "rtfd")) Or Not AnEntryFI.Visible Or Left(AnEntryFI.Name,1) = "." Or AnEntryFI.Alias Then // Do nothing in these cases Else // Code to add the AnEntryFI.Name into the ListBox End If

(AnEntryFI.Directory And (Right(AnEntryFI.Name,4) <> "rtfd")) // Exclude Directories (Folder), but not OS X’s RTFD files * Not AnEntryFI.Visible // Exclude invisible files Left(AnEntryFI.Name,1) = "." // Exclude files whose name starts with a dot AnEntryFI.Alias // Exclude Links (Alias)

Unfortunately, I get the Directory and Alias Names (and I do not had time to really check if invisible anddot prefixed files are displayed in the ListBox or not).

Am I right, wrong, Whatever ?

  • RTFD files are displayed as special rtf files (bundles), but are in reality folders (directories) on OS X, so when I excluded directories, I do not get my wonderful styled texts with images in my TextArea.

PS: I knew there was reasons why I stopped to use RTF with Xojo, but forgot why. Now I recall.

I forgot to put #If TargetCocoa around declares to Cocoa and get errors telling a library was missing (which library ?) when I started to debug the application on WIndows. Fortunately, it had only two MenuHandlers and two events to check code… not a 30MB project file !

Do you want this to run under Windows?

If so - exclude directories purely on the basis of being true ( no idea what RTFD files are ). Then, on Windows, f.trueitem name will have the extension “.lnk” - check against that for aliases.

Why not a simple shell command if your app is for osx?
not -type d 'exclude directories

find /User_folder/  -not -type d | egrep -v '\\. RTFD$' | wc -l

On windows side

dir *. RTFD  /b/s

link for the dir and windows shell commands

[quote]@Peter Job]Do you want this to run under Windows?
( no idea what RTFD files are )[/quote]

[quote=259722:@Loannis Kolliageorgas]


“RTFD files cannot be opened properly by applications on Windows, which does not support the concept of bundles.”

[quote=259725:@Peter Job]Quite.

“RTFD files cannot be opened properly by applications on Windows, which does not support the concept of bundles.”[/quote]
I read it, but the @Emile Schwarz ask how to find the files,no how will be opened…

rtfd is seen under windows as a folder containing a file called TXT.rtfd which can be opened by WordPad.

I think Peter gave the right answer. Alias does not work under Windows, so checking for .lnk will work.

Thanks for all answers.

As you can see, theis is the Windows Channel, but the “application” have to run under both OS X and Windows.

It was in a different Conversation that I wrote I have to provide two set fo data, one for each OS:

a. one set of rtfd files that will be displayed with images on OS X

b. a second set of rtf files for Windows (and apparently no images:( )

Channel confusion: this happens to me too, sometimes ;-:slight_smile:

I nearly forgot: on OS X, one can ask the Finder to open RTFD files (as a Folder) and so, we can watch what’s inside the RTFD bundle. I use that, sometimes, to change the rtf page settings and tab values…)

I can’t edit my previous post’s…
My first answer for mac search is wrong,is for count files :wink:
Here is the right one

find /User_Folder/ -name "*.RTFD"