Cast string as filesystem object?

(imported topic written by atxrobbie)

I’m trying to read the contents of a file and look for a directory path. Once i find that path (which I’m successfully able to do) I want to check mode and mask of that path. It seems as though I’m not able to do so because I need to cast the string returned in my query as a filesystem object. Is this possible?

thanks,

(imported comment written by SystemAdmin)

The following takes a folder, turns it to a string containing its path, adds a file name, then turns that path as a string into a file object:

q:file (system folder as string & “\cmd.exe”)

A: “cmd.exe” “6.1.7601.17514” “Windows Command Processor” “6.1.7601.17514 (win7sp1_rtm.101119-1850)” “Microsoft Corporation”

q:exists file (system folder as string & “\cmd.exe”)

A: True

q:file (“C:\laksfj\asfdlj\asfljd.ksdfj”)

E: Singular expression refers to nonexistent object.

q:exists file (“C:\laksfj\asfdlj\asfljd.ksdfj”)

A: False

Is this what you are looking for?

(imported comment written by atxrobbie)

That’s close, and I’ll certainly keep that on hand. here is an example of what I’m trying to do (and its in Linux).

requirement: read $PATH and check permissions and ownership of each entry in $PATH (for any given user)

Here is my relevance that is not working:

Q: ((((substrings separated by “:” of it) of values of variable “PATH” of environment) as string) whose (other write of it = true))

E: The operator “other write” is not defined.

Here is the output that I need to be able to check permissions and ownership on:

Q: ((substrings separated by “:” of it) of values of variable “PATH” of environment)

A: /bin

A: /usr/bin

A: /usr/bin/X11

A: /usr/local/bin

A: /usr/local/X11/bin

So my question is, how to I convert the Answers into a filesystem object that i can then check permissions against?

thanks,

(imported comment written by jeremylam)

This is Windows (using a ; instead of :), but it creates folder objects from my PATH environment variable:

folders ((substrings separated by ";" of it) of values of variable "PATH" of environment)

(imported comment written by NoahSalzman)

Q: (mode of it, it) of folders ((substrings separated by “:” of it) of (values of variable “PATH” of environment))

A: rwxr-xr-x, /usr/kerberos/bin

A: rwxr-xr-x, /usr/local/bin

A: rwxr-xr-x, /usr/bin

A: rwxr-xr-x, /bin

A: rwxr-xr-x, /usr/X11R6/bin

(imported comment written by atxrobbie)

this worked perfectly! much thanks!