mktrashcan, rmtrashcan, shtrashcan - Attaches, detaches,
or shows a trashcan directory
/usr/sbin/mktrashcan trashcan directory...
/usr/sbin/rmtrashcan directory...
/usr/sbin/shtrashcan directory...
Specifies the directory that contains files that were
deleted from attached directories. Whenever you delete a
file in the specified directory, the file system automatically
moves the file to the trashcan directory. Specifies
the directory that you attach to a trashcan directory.
The trashcan utilities (mktrashcan and rmtrashcan) enable
you to attach or detach an existing directory, which you
specify as a trashcan directory, to any number of directories
within the same fileset.
A trashcan directory stores the files that are deleted
with the unlink system call. For instance, you can use the
mktrashcan utility to attach a trashcan directory called
/usr/trashcan to one or more directories; thereafter, when
you delete a file from one of the attached directories,
the file system moves the file to the /usr/trashcan directory.
Note that when more than one directory shares
attachment to a trashcan directory, files with the same
file name can overwrite each other in the trashcan directory.
If you mistakenly delete a file, use the mv command to
return the file from the /usr/trashcan directory to its
original directory.
When you enter shtrashcan at the system prompt, the system
shows the trashcan directory, if one exists, for the
directory you specified.
It is important that trashcan directories have correct
access permissions. If the permissions are too restrictive,
then it may be impossible to remove files from the
directories that are attached to the trashcan directory.
In general, all users and groups that expect to use the
trashcan directory need write permission to the directory.
If unexpected "permission denied" errors occur when deleting
files that are in a directory attached to a trashcan
directory, use the chmod command to change the permissions
on the trashcan directory.
The directory and trashcan directories must be in the same
fileset; however, you can attach the trashcan directory to
any directory within the fileset.
The following example creates and attaches a trashcan
directory, /usr/trashcan, to two directories, /usr/ray and
/usr/projects/sql/test, which are in the same fileset. The
chmod command adds write permission for all users and
groups on the new trashcan directory. % mkdir /usr/trashcan
% chmod a+w /usr/trashcan % mktrashcan /usr/trashcan
/usr/ray /usr/projects/sql/test To attach the trashcan
directory, /usr/trashcan, to all subdirectories in the
/usr directory, enter: % mktrashcan /usr/trashcan /usr/*
New subdirectories that you add beneath the /usr
directory are not attached to the trashcan directory
until you attach them. Also, the mktrashcan
utility distinguishes between directories and
files, attaching only directories to the trashcan
directory.
Note that an attached directory produces an EDUPLICATE_DIRS
(-1165) error when /usr/trashcan is
itself in the directory path you attach to (as in
the previous example). You can ignore this error
message.
advfs(4), mkfset(8), showfsets(8)
mktrashcan(1)
[ Back ] |