1!: Files

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Dictionary

Files | 1!:

Except as otherwise noted, a file may be specified by a name (such as`<'sub\abc.q'`)`` or by an integer file number obtained from open`` (`1!:21 <'sub\abc.q'`).

`1!:0 y` | Directory.`y` is a string of the path search expression (a boxed string is also accepted); the result is a 5-column table of the file name, modification time, size, permission, and attributes, individually boxed. For example, try`1!:0 '*.*'`.`` The permission and attribute columns are system dependent. For example, in Windows:
       1!:0 'j.exe'
    +-----+-----------------+------+---+------+
    |j.exe|1998 2 2 14 33 46|676864|rwx|-----a|
    +-----+-----------------+------+---+------+
Permission is a 3-letter string indicating the read, write, and execute permissions. Attributes is a 6-letter string indicating read-only, hidden, system, volume label, directory, and archive.
`1!:1 y` | Read.`y` is a file name or a file number (produced by`1!:21`); the result is a string of the file contents., e.g.`1!:1 <'abc.q'`.`` The following values for`y` are also permitted: `1` read from the keyboard (does not work within a script) `3` (Unix only) read from standard input (`stdin`)
`x 1!:2 y` | Write.`x` is a string of the new contents of the file;`y` is a file name or file number (produced by`1!:21`).`` The following values for`y` are also permitted: `2` screen output. `4` (Unix only) standard output (`stdout`) `5` (Unix only) standard error (`stderr`)
`x 1!:3 y` | Append. Like`x 1!:2 y`,`` but appends rather than replaces
`1!:4 y` | Size
`1!:5 y` | Create Directory.`y` is a (boxed) directory name
`[x] 1!:6 y` | Query/Set Attributes.
`[x] 1!:7 y` | Query/Set Permissions.
`1!:11 y` | Indexed Read.`y` is a list of a boxed file name (or number) and a boxed index and length. The index may be negative. If the length is elided, the read goes to the end. For example:
    1!:11 'abc.x';1000 20
    f=: 1!:21 <'abc.x'
    1!:11 f,1000 20
`x 1!:12 y` | Indexed Write.`x` is the string to be written;`y` is a list of a boxed file name (or number) and a boxed index.
`1!:20 y` | File Numbers and Names. A 2-column table of the open file numbers and names.
`1!:21 y` | Open. Open file named`y`,`` creating it if necessary; result is a file number.
`1!:22 y` | Close. Close file named or numbered`y`.`` Any locks are released.
`1!:30 y` | Locks. A 3-column integer table of the file number, index, and length of file locks. The argument`y` is required but ignored.
`1!:31 y` | Lock.`y` is a 3-element integer vector of the file number, index, and length of the file region to be locked; the result is 1 if the request succeeded, and 0 if it did not.
`1!:32 y` | Unlock.`y` is a 3-element integer vector of the file number, index, and length of the file region to be unlocked.
`1!:43 y` | Query Current Working Directory. Query the current working directory (Posix`getcwd`).
`1!:44 y` | Set Current Working Directory. Set the current working directory (Posix`chdir`).
`1!:45 y` | Profile. The default profile. In Windows,`1!:45` returns`profile.ijs` in the path of the J Front End (`j.exe` or`jconsole.exe`). For example:`c:\j501a\profile.ijs` . In Unix,`1!:45` uses environment variables and the J version to determine the default profile: The version is the text in`9!:14 ''` up to the first`/` .`` If`9!:14 ''` returned`j501a/2002-07-05/17:50` ,`` then the version is`j501a` . If`HOME/version/profile.ijs` exists, then it is the default profile. For example, if`HOME` was`/home/eric` ,`` then`/home/eric/j501a/profile.ijs` would be the default profile if it existed. If that file doesn't exist, environment variable`JPATHversion` (for example,`JPATHj501a`), if it is defined, is the default profile.
`1!:55 y` | Erase File/Directory. e.g.,`1!:55<'careful'`

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Dictionary