Sponsored Content
Top Forums UNIX for Dummies Questions & Answers remove files from a directory Post 302337561 by freddie88 on Friday 24th of July 2009 11:09:16 AM
Old 07-24-2009
this is my home directory and that is a good question about duplicate file names... these were created from a script I ran and could not remove after script was completed (ran script multiple times before I saw this)

Code:
lpiva8026 $ls -l
total 5
-rwxr-xr-x    1 schroeks x_exp           768 Jul 21 13:16 cdrrd
-rwxr-----    1 schroeks x_exp          1492 Jul 23 12:56 cdrrd1
-rw-r--r--    1 schroeks x_exp             0 Jul 23 10:00 rrd
-rw-r--r--    1 schroeks x_exp             0 Jul 21 08:24 rrd15CEC
-rw-r--r--    1 schroeks x_exp             0 Jul 21 11:37 rrd15CEC
-rw-r--r--    1 schroeks x_exp             0 Jul 21 11:59 rrd15CEC
-rw-r--r--    1 schroeks x_exp             0 Jul 21 08:47 rrd15CEC
-rw-r--r--    1 schroeks x_exp             0 Jul 21 15:48 rrd21CEM
-rw-r--r--    1 schroeks x_exp             0 Jul 21 15:39 rrd21CEC
-rw-r--r--    1 schroeks x_exp             0 Jul 23 08:12 rrd21CEM

 

10 More Discussions You Might Find Interesting

1. HP-UX

Want to remove files from unix directory

Dear All I am basic user of Unix. i woul like to delete some files (basically 05 and 0801111105) from unix directories but unable to delete it I tried all option. rm , rm -f etc.. but not succeed. Infact it also not allowing me to use chmod option so that i can grant 777 option to... (1 Reply)
Discussion started by: yogi_chavan
1 Replies

2. Shell Programming and Scripting

remove duplicate files in a directory

Hi ppl. I have to check for duplicate files in a directory . the directory has following files /the/folder /containing/the/file a1.yyyymmddhhmmss a1.yyyyMMddhhmmss b1.yyyymmddhhmmss b2.yyyymmddhhmmss c.yyyymmddhhmmss d.yyyymmddhhmmss d.yyyymmddhhmmss where the date time stamp can be... (1 Reply)
Discussion started by: asinha63
1 Replies

3. UNIX for Dummies Questions & Answers

remove old files from a directory

Hello I'm new to this forum, so I did a quick scan of the FAQs to see if my problem had been addressed already, since I believe it is probably a very common need. I was surprised that I did not see anything obvious. I need to remove all files from a directory that have a last modified date... (2 Replies)
Discussion started by: 2davidc8
2 Replies

4. UNIX for Advanced & Expert Users

Can't list or remove files from a directory

Hi I have a problem. One of the directories in /var, on one of my servers, has filled up with loads of files. I have tried to list the directory to see what is in it, but the 'ls' command just hangs. Same thing happens when I try to use 'rm' to remove files from that directory. I can see what... (2 Replies)
Discussion started by: m_smith
2 Replies

5. Shell Programming and Scripting

Remove files from a directory using perl

Hi all, I have the following question. Considder that in the directory /code the script remove.pl exists. What i want is to run this script and remove some files that exist in the directory /dir/tmp. I use the below code but it does not work. system("cd /dir/code"); system("rm FileName"); ... (6 Replies)
Discussion started by: chriss_58
6 Replies

6. UNIX for Dummies Questions & Answers

How to remove directory with subdirectories and files?

I'm trying to remove several directories which contains sun-dirs and files inside. I used the command rm -r <dirname> But, it always ask "examine file in directory <dirname> yes/no?" line by line. So, i need to write "y" for every line. How can i skip this step and remove all directories with... (9 Replies)
Discussion started by: ppa108
9 Replies

7. Shell Programming and Scripting

Remove duplicate files in same directory

Hi all. Am doing continuous backup of mailboxes using rsync. So whenever a new mail arrives it is automatically copied on backup server. When a new mail arrives it is named as xyz:2, when it is read by the email client an S is appended xyz:2,S Eventually , 2 copies of the same file exist on... (7 Replies)
Discussion started by: coolatt
7 Replies

8. Shell Programming and Scripting

Remove two types of files from a directory

Hi All, i need to move two types of files from a directory. I have used the below command to find the files from the directory.. SOURCE_DIR="some directory path" TARGET_DIR="Target Dir" Datestamp=Date_format find $SOURCE_DIR \( -name "*.log" -o -name "*.out" ) - exec ls -1 {} \; now i... (9 Replies)
Discussion started by: ch33ry
9 Replies

9. Shell Programming and Scripting

remove a whole directory tree WITH files inside?

Assume I want to remove a whole directory tree beginning with /foo/bar/ The directory or sub-directories may contain files. The top directory /foo/bar/ itself should not be deleted. rm -f- r /foo/bar does not work because it requires a directory tree without files. How does it work... (3 Replies)
Discussion started by: pstein
3 Replies

10. Shell Programming and Scripting

Remove empty files in home directory

how to remove empty files tried below command its remove only zero bytes not empty file which is greater then zero byte. for x in * do if then rm $x fi done (8 Replies)
Discussion started by: Kalia
8 Replies
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)
All times are GMT -4. The time now is 10:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy