Identifying Invisible Files & Folders

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Identifying Invisible Files & Folders

Post by johnmiller1950 » Sun Jan 17, 2016 12:16 pm

Greetings All,

I am trying to present the user with a list of files and folders contained in the defaultfolder. However, I do NOT want them to see anything that the system identifies as invisible. I filter my list ("filter listXX without ".*") which removes some of the offending items, but there are still a number of others. On my Mac I have files named bin, cores, Network, private, sbin, etc., etc., etc. I have not yet tried this on Windows.

Using "answer file" and "answer folder" doesn't do what I am trying to accomplish.

Is there some other way in LiveCode to identify these "invisible" folders/files ?

Thanks for your help.

John Miller

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: Identifying Invisible Files & Folders

Post by quailcreek » Mon Jan 18, 2016 5:18 am

Hi John,
Why don't you share your code so we can see where you're at and what you're trying to accomplish.
Tom
MacBook Pro OS Mojave 10.14

FredBeck
Posts: 77
Joined: Fri Nov 01, 2013 3:07 pm
Contact:

Re: Identifying Invisible Files & Folders

Post by FredBeck » Mon Jan 18, 2016 10:29 am

Hi John,
I don't know Mac but on Windows you can shell "dir /a:h" to get the hidden files, and "dir /a:-h for the visible files.
Fred.

ps : in case you don't have a win machine at hand, here's what the output looks like
Image

johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Re: Identifying Invisible Files & Folders

Post by johnmiller1950 » Mon Jan 18, 2016 11:26 pm

OK ! Here's my code. I am trying to browse through the directories on my computer without encountering folders and files that are normally "invisible" in the finder. In other words, I am trying to duplicate the "Finder" experience.

on getDirectory
set the default folder to "//Volumes/Macintoch HD/"
put the folders into fXX
put CR & the files after fXX
filter fXX without ".*"
filter fXX without "_*"
put fXX into cd fld "Directory List"
end getDirectory

My filters remove the obvious selections. However, there are many more listed.

Calling the handler above gives a list of folders and files (see below.) The files I want to see are listed in BOLD (actually only six items).
Applications
bin
cores
Library
Network
private
sbin
System
Users
usr
Volumes
dev
etc
home
installer.failurerequests
net
tmp
User Guides And Information
User Information
var

Thanks for your help.
John

johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Re: Identifying Invisible Files & Folders

Post by johnmiller1950 » Mon Jan 18, 2016 11:36 pm

Hello Again.

Following up on Fred's suggestion. Using "put shell("ls -1 -F") into fXX" outputs . . .

Applications/
Library/
Network/
System/
User Guides And Information@
User Information@
Users/
Volumes/
bin/
cores/
dev/
etc@
home/
installer.failurerequests
net/
private/
sbin/
tmp@
usr/
var@

The "/" identifies a directory, and the "@" identifies a link which could be useful but doesn't solve my problem.

I'll keep digging around in the terminal and see if I can discover an answer to my problem.

If anybody already knows the answer or wants to jump in, I'd appreciate it.

John

johnmiller1950
Posts: 116
Joined: Mon Apr 30, 2007 3:33 pm

Re: Identifying Invisible Files & Folders

Post by johnmiller1950 » Tue Jan 19, 2016 6:41 pm

OK ! I found it.

Issuing the command . . . "put shell("ls -1 -l -O") into fXX" . . . gives me the following list. Now I can use . . . "filter fXX without "*hidden*"" which gives me only the files I want.

drwxrwxr-x+ 70 root admin sunlnk 2380 Jan 6 17:02 Applications
drwxr-xr-x+ 67 root wheel sunlnk 2278 Nov 4 20:11 Library
drwxr-xr-x@ 2 root wheel hidden 68 Oct 6 16:25 Network
drwxr-xr-x@ 4 root wheel restricted 136 Dec 18 11:55 System
lrwxr-xr-x 1 root wheel - 60 Nov 9 2012 User Guides And Information -> /Library/Documentation/User Guides and Information.localized
lrwxr-xr-x 1 root wheel - 49 Nov 9 2012 User Information -> /Library/Documentation/User Information.localized
drwxr-xr-x 7 root admin - 238 Oct 6 16:25 Users
drwxrwxrwt@ 10 root admin hidden 340 Jan 19 11:34 Volumes
drwxr-xr-x@ 39 root wheel restricted,hidden 1326 Dec 18 11:55 bin
drwxrwxr-t@ 2 root admin hidden 68 Oct 6 16:25 cores
dr-xr-xr-x 3 root wheel hidden 4506 Jan 2 21:34 dev
lrwxr-xr-x@ 1 root wheel restricted,hidden 11 Oct 6 16:24 etc -> private/etc
dr-xr-xr-x 2 root wheel hidden 1 Jan 15 15:31 home
-rw-r--r--@ 1 root wheel hidden 313 Aug 22 22:35 installer.failurerequests
dr-xr-xr-x 2 root wheel hidden 1 Jan 15 15:31 net
drwxr-xr-x@ 6 root wheel hidden 204 Oct 6 16:25 private
drwxr-xr-x@ 59 root wheel restricted,hidden 2006 Dec 18 11:55 sbin
lrwxr-xr-x@ 1 root wheel restricted,hidden 11 Oct 6 16:24 tmp -> private/tmp
drwxr-xr-x@ 12 root wheel restricted,hidden 408 Oct 6 16:31 usr
lrwxr-xr-x@ 1 root wheel restricted,hidden 11 Oct 6 16:24 var -> private/var

Thanks for pushing me in the right direction, Fred.

John

FredBeck
Posts: 77
Joined: Fri Nov 01, 2013 3:07 pm
Contact:

Re: Identifying Invisible Files & Folders

Post by FredBeck » Tue Jan 19, 2016 6:51 pm

YW
for once Mac look more complicated than windows :)

Post Reply