04-13-2008
However, it doesn't work if there are directory names with spaces in them.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi,
I accidentally deleted a big directory with all its sub-directories and bunch of source code files which I have been developing for about 2 years... What will I do now, how can I retrieve my files, directory hierarchy back ???
If anyone, please HELP ! ! ! ... (4 Replies)
Discussion started by: milhan
4 Replies
2. Shell Programming and Scripting
i have the following problem:
use shell script:
Two directories have to be searched for files havin the same name.
then delete these files from one of these directories.
the directory names have to be accepted as command line arguments.
what i have done till now is:
1. run a loop... (1 Reply)
Discussion started by: onlyc
1 Replies
3. Shell Programming and Scripting
Hello Gurus,
I want to delete only empty files (files with 0 bytes) at once from the local directory. Rightnow I need to go through all the files one by one manually and check the empty files before deleting them. Is there any unix command that finds and deletes empty files in a directory?... (5 Replies)
Discussion started by: berlin_germany
5 Replies
4. UNIX for Dummies Questions & Answers
I have a directory full of text data files.
Unfortunately I need to get rid of the 7th and 8th line from them all so that I can input them into a GIS application.
I've used an awk script to do one at a time but due to the sheer number of files I need some kind of loop mechanism to automate... (3 Replies)
Discussion started by: vrms
3 Replies
5. Shell Programming and Scripting
I need the unix command or shell script to delete all the file in current directory and sub directory. (7 Replies)
Discussion started by: kingganesh04
7 Replies
6. UNIX for Dummies Questions & Answers
I have a file inside abc/def/ghi directory. let say a.txt
I need to delete this a.txt from abc itself.
I have tried
ls /abc/def/ghi | xargs rm -r
its saying
rm: a.txt non-existent
also tried rm -rf /def/ghi
but in vein. plz help :) (2 Replies)
Discussion started by: gotam
2 Replies
7. Shell Programming and Scripting
Hi Friends,
I am new to this , I am working on AIX system and my scenario is to retrive the files from remote system and remove the files from the remote system after retreving files. I can able to retrieve the files but Can't remove files in remote system. Please check my code and help me out... (3 Replies)
Discussion started by: vinayparakala
3 Replies
8. Shell Programming and Scripting
I have 4 files in a directory and want to delete only first 2 files only..
$ ls -ltr
total 640
-rw-r--r-- 1 user other 148779 Oct 12 10:50 file1.xls
-rw-r--r-- 1 user other 148779 Oct 12 10:50 file2.xls
-rw-r--r-- 1 user other 148779 Oct 12 10:50 file3.xls... (4 Replies)
Discussion started by: giridhar276
4 Replies
9. Shell Programming and Scripting
I have a qnap TS259 that is running ubuntu. Have successfully setup back scripts that are initiated by cron.
I would like to create a couple scrypts that would operate on the recycle bins for both drives. Just want to be able to run the script manually that would walk through both directories... (13 Replies)
Discussion started by: mackconsult
13 Replies
10. UNIX for Dummies Questions & Answers
Hi Folks,
I have a directory in unix that is /usr/local/pos contain the folowing directoreis ..that is
dir1
dir2
dir3
now I want to delete only dir2 please advise how to remove the directory dir 2 ..that is rm command and how to use it , and second if I want to zip the dir3 please... (1 Reply)
Discussion started by: punpun66
1 Replies
LEARN ABOUT OSF1
rmtrashcan
mktrashcan(1) General Commands Manual mktrashcan(1)
NAME
mktrashcan, rmtrashcan, shtrashcan - Attaches, detaches, or shows a trashcan directory
SYNOPSIS
/usr/sbin/mktrashcan trashcan directory...
/usr/sbin/rmtrashcan directory...
/usr/sbin/shtrashcan directory...
OPERANDS
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.
DESCRIPTION
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 impossi-
ble 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.
RESTRICTIONS
The directory and trashcan directories must be in the same fileset; however, you can attach the trashcan directory to any directory within
the fileset.
EXAMPLES
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.
SEE ALSO
advfs(4), mkfset(8), showfsets(8)
mktrashcan(1)