Getting certain file attrib / attributes

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

Getting certain file attrib / attributes

Post by newpie »

Hello, I searched for a method to to find out a particular Attrib of a file to no avail, particularly the "Attributes" section (pics below).

I just had a few questions:
1. Is there a LC command I am missing that can set file attributes besides using shell command
2. Is there a way to get the specific attrib in the pics below with a LC command. I am unsure on how to use shell command here.
2a. Generic - I know there is a command "files" and you can code to find certain attributes, which looks thru a folder. Is there a LC command to just target a single file with a file path?

I tested the below file pics and both give me 777.

Files command excerpt:

The detailed files form returns a list of files, one file per line. Each line contains the following attributes, separated by commas:
* The file's name, URL-encoded
* The file's size in bytes (on Mac OS and OS X systems, the size of the file's data fork)
* The resource fork size in bytes (Mac OS and OS X systems only)
* The file's creation date in seconds (Mac OS, OS X, and Windows systems only)
* The file's modification date in seconds
* The file's last-accessed date in seconds (Unix, OS X and Windows systems only)
* The file's last-backup date in seconds (Mac OS and OS X systems only)
* The file's owner (Unix and OS X systems only)
* The file's group owner (Unix and OS X systems only)
* The file's access permissions
* The file's creator and file type (Mac OS and OS X only)
Any attribute that is not supported on the current system is reported as empty.
Attachments
-A
-A
Capture2.PNG (2.05 KiB) Viewed 7011 times
+A
+A
Capture.PNG (2.88 KiB) Viewed 7011 times
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Getting certain file attrib / attributes

Post by Klaus »

Hi newpie,

1. No.
2. No. No idea how to use shell for this, sorry...
2.a. Unfortunately not.


Best

Klaus
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Getting certain file attrib / attributes

Post by FourthWorld »

It would be convenient to have a built-in function for getting info on a single file (and I believe there's a request for this in queue), but in the meamtime using the detailed files you can script your own function in a few minutes.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

Re: Getting certain file attrib / attributes

Post by newpie »

@Klaus = Thank you Klaus for your response.

@FourthWorld = Can you confirm this request in the queue, specifically the attrib I am looking in the pics, or should I put a post this in the idea forum.

Thanks
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Getting certain file attrib / attributes

Post by FourthWorld »

I don't know what "A" and "N" signify in your screen shot above. Everything else is available in the detailed files.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

Re: Getting certain file attrib / attributes

Post by newpie »

Here is the list of attributes the "N" is = to "I".

I didn't test all these attributes, are you saying I can see these (besides I/N) easily with the detailed files command? Is there a request for these that you know of.

Thanks FourthWorld
Attachments
I = N
I = N
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Getting certain file attrib / attributes

Post by FourthWorld »

Your first post here shows that you're looking for file size, date created, and date modified. That post also includes the relevant portion of the Dictionary entry showing those elements are included in the info returned from "the detailed files". Even access permissions are shown there (though I'd have to double check that entry to make sure that reflects things specific to the Windows for system).

Looks like you have everything you're looking for right at your finger tips. Use lineoffset with a urlEncode on the name of the file you're looking for to get the line number, then grab the relevant items from that line.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

Re: Getting certain file attrib / attributes

Post by newpie »

I apologize for the confusion. I was specifically looking for the -A and N attribute actually from my first post. I just listed the "files"dictionary excerpt to show what is there already. I tested the Hidden attribute and the three octal digits from the "files" command is still 777. So from what I can tell I can't find this data with the "files" command. What is your thoughts on this? I might put in the idea forum then just in case.

Thanks
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Getting certain file attrib / attributes

Post by FourthWorld »

You may have to use LC's shell function to call out to DOS or PowerShell for Windows-specific file system attributes.

This will all become much simpler once Windows adopts a Linux kernel. :)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Post Reply