---
name: "ns_file"
section: "3"
platform: "linux"
package: "aolserver4"
version: "4.0.10-7"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/ns_file"
---

# ns\_file(3)

File manipulation commands

```

```

## NAME

ns\_chmod, ns\_cp, ns\_cpfp, ns\_ftruncate, ns\_link, ns\_mkdir, ns\_rename, ns\_rmdir, ns\_symlink, ns\_truncate, ns\_unlink - File manipulation commands

## SYNOPSIS

**ns\_chmod** *option* ?*arg arg ...*?

**ns\_cp** *option* ?*arg arg ...*?

**ns\_cpfp** *option* ?*arg arg ...*?

**ns\_ftruncate** *option* ?*arg arg ...*?

**ns\_link** *option* ?*arg arg ...*?

**ns\_mkdir** *option* ?*arg arg ...*?

**ns\_rename** *option* ?*arg arg ...*?

**ns\_rmdir** *option* ?*arg arg ...*?

**ns\_symlink** *option* ?*arg arg ...*?

**ns\_truncate** *option* ?*arg arg ...*?

**ns\_unlink** *option* ?*arg arg ...*?

```

```

## DESCRIPTION

- **ns\_chmod** *filename* *mode*

  Change a file's access permissions.  ns\_chmod changes the specified file's permissions to mode, in the same manner as the Unix [chmod(1)](/chmod/1.md) command-line utility.

- **ns\_cp** *-preserve* *file1* *file2*

  Copy one file to another.  ns\_cp copies the contents of file1 to file2, just like the Unix "cp" command. The default directory is the home directory for the server.  If -preserve is specified, the copied file will retain the creation time, modification time, owner, and mode of the original file, just like the Unix "cp -p" command.

- **ns\_cpfp** *fileid1* *fileid2* *?nbytes?*

  Copy a specified number of bytes from one file to another.  ns\_cpfp copies information from one file (fileid1) to another (fileid2). If you specify a number of bytes in the nbytes argument, only the specified number of bytes will be copied. By default, the entire file is copied.

- **ns\_ftruncate** *fileid* *?length?*

  Truncate an open file to a specified length.  ns\_ftruncate causes the open file specified by fileid to have a size of length bytes. If length is not specified, it causes the file to have a size of zero bytes. The file must be open and be a regular file.

- **ns\_link** *?-nocomplain?* *filename1* *filename2*

  Create a link.  ns\_link creates a link named filename2 that points to the file specified by filename1. If the link fails, a Tcl error is generated, unless -nocomplain is specified.

- **ns\_mkdir** *path*

  Create a directory.  ns\_mkdir creates the directory named PATH, just like the Unix mkdir command. By default, under Unix the directory is created with the file permissions set to 0755 (rwxr-xr-x.). These permissions can be modified by setting the umask parameter for the server.

- **ns\_rename** *file1* *file2*

  Rename a file.  ns\_rename renames the first file (file1) to the file name specified by file2. Make sure that the files and the directories in which the files exist are read/write accessible to the username that's running the AOLserver.

- **ns\_rmdir** *path*

  Remove a directory.  ns\_rmdir removes the directory named path, just like the Unix rmdir command. The directory must already be empty.

- **ns\_unlink** *\[-nocomplain\]* *filename*

  Remove a file.  ns\_unlink attempts to remove the file filename. If -nocomplain is not passed in and the removal fails, a Tcl error is generated.

- **ns\_truncate** *filename* *?length?*

  Truncate a file to a specified length.  ns\_truncate causes the file specified by filename to have a size of length bytes. If length is not specified, it causes filename to have a size of zero bytes. The file must exist and be a regular file.

- **ns\_unlink** *\[-nocomplain\]* *filename*

  Remove a file.  ns\_unlink attempts to remove the file filename. If -nocomplain is not passed in and the removal fails, a Tcl error is generated.

## SEE ALSO

ns\_chmod, ns\_cp, ns\_cpfp, ns\_ftruncate, ns\_link, ns\_mkdir, ns\_rename, ns\_rmdir, ns\_symlink, ns\_truncate, ns\_unlink

## KEYWORDS
