Sponsored Content
Full Discussion: Removing files exclusively
Top Forums UNIX for Dummies Questions & Answers Removing files exclusively Post 66833 by phil1t on Thursday 17th of March 2005 08:00:14 AM
Old 03-17-2005
It will not remove the current directory so you can do the following;
find . -name '*Copy*' -prune -o -exec rm -r {} \; 2>/dev/null

Example;
# ls -lia
total 40
129053 drwxr-xr-x 5 root system 512 Mar 17 06:58 .
63492 drwxr-xr-x 9 pthompso staff 1536 Mar 16 19:16 ..
129054 drwxr-xr-x 2 root system 512 Mar 17 06:53 Copy
129109 -rw-r--r-- 1 root system 0 Mar 17 06:55 Copyaaa
129106 -rw-r--r-- 1 root system 0 Mar 17 06:57 Copyxxx
129108 -rw-r--r-- 1 root system 0 Mar 17 06:54 aaaCopyaaa
133120 drwxr-xr-x 2 root system 512 Mar 17 06:58 cat
129111 drwxr-xr-x 2 root system 512 Mar 17 06:58 dog
129107 -rw-r--r-- 1 root system 0 Mar 17 06:57 xxxCopy
129110 -rw-r--r-- 1 root system 0 Mar 17 06:58 xxxCopyxxx
# find . -name '*Copy*' -prune -o -exec rm -r {} \; 2>/dev/null
# ls -lia
total 24
129053 drwxr-xr-x 3 root system 512 Mar 17 06:59 .
63492 drwxr-xr-x 9 pthompso staff 1536 Mar 16 19:16 ..
129054 drwxr-xr-x 2 root system 512 Mar 17 06:53 Copy
129109 -rw-r--r-- 1 root system 0 Mar 17 06:55 Copyaaa
129106 -rw-r--r-- 1 root system 0 Mar 17 06:57 Copyxxx
129108 -rw-r--r-- 1 root system 0 Mar 17 06:54 aaaCopyaaa
129107 -rw-r--r-- 1 root system 0 Mar 17 06:57 xxxCopy
129110 -rw-r--r-- 1 root system 0 Mar 17 06:58 xxxCopyxxx
#
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Removing Files

I am trying to remove a file so that I can delete a directory. Unfortuantely the file looks like this --------.--- and the system is not allowing me to remove the file. System message is rm: Error: Illegal option -- - usage: rm file... I have tried rm * and rm *.* to no avail. Any... (5 Replies)
Discussion started by: Blondie
5 Replies

2. UNIX for Advanced & Expert Users

Removing files

Hi, It seems someone has created files instead of actually running the commands, as below: -rw-r--r-- 1 oracle92 dba 0 Mar 2 11:19 PRIML_070302.ok -rw-r--r-- 1 oracle92 dba 557 Mar 2 11:20 PRIVH_070302.dat -rw-r--r-- 1 oracle92 dba 0 Mar 12 11:57... (2 Replies)
Discussion started by: LiquidChild
2 Replies

3. Shell Programming and Scripting

removing old files except configuration files and folders

Dear all, I want to remove files older than 2 months in the /home/member directory. But except the configuration files (like .bash_profile .config/ .openoffice/ .local/ .kde/ etc..) I have tried with the command find . -mtime +60 -wholename './.*' -prune -o -print -exec mv {} \; but it... (1 Reply)
Discussion started by: jamcalicut
1 Replies

4. UNIX for Dummies Questions & Answers

Removing Files

Hi, This might seem like a really stupid question but i have created a shell script and at the end of the script i want to remove most of the file i create. So I have: rm file test sorted However this does not work for the sorted one. The only way i can get this to work is if i do: rm... (4 Replies)
Discussion started by: jazz8146
4 Replies

5. SuSE

can't open /dev/sda3 exclusively

Hi, please help!!! I'm installing an openSUSE 10.3 into a computer, after creating the following partitions: Primay Partition swap / LVM(volume manager) - /dev/sda3 /opt, /var, /tmp, /usr, /local when i tried to continue installing, after creating the partitions i am prompted with the... (2 Replies)
Discussion started by: etcpasswd
2 Replies

6. UNIX for Dummies Questions & Answers

Removing files

How do you delete/remove multiple files ? (5 Replies)
Discussion started by: nosuchluck
5 Replies

7. UNIX for Dummies Questions & Answers

Help in Removing the Old files

Hi Gurus, we are planning to clear the old log files based on the year and i need help on this and i searched in google and i came up with the scripts but i am stuck with this. (1) wroks fine How many files exist in based on the extension find -type f | sed -e 's/.*\.//' | sort | uniq... (1 Reply)
Discussion started by: SeenuGuddu
1 Replies

8. UNIX for Advanced & Expert Users

Pvcreate can't open /dev/xvda2 exclusively mounted filesystem

I downloaded the oracle linux 6.7 from RHEL, I wanted to extend the storage for "/" from default 16GB to say 200GB. Here's the steps I tried is : 1. Init 1 2. Using “fdisk /dev/xvda” , delete the swap /dev/xvda3 as well as /dev/xvda2 3. Re-create /dev/xvda2 with linux LVM using new end blocks ... (1 Reply)
Discussion started by: alnhk
1 Replies

9. Red Hat

Pvcreate can't open /dev/xvda2 exclusively mounted filesystem

I downloaded the RH Linux 6.7 from RHEL, I wanted to extend the storage for "/" from default 16GB to say 200GB. Here’s the steps I tried is : 1. Init 1 2. Using “fdisk /dev/xvda” , delete the swap /dev/xvda3 as well as /dev/xvda2 3. Re-create /dev/xvda2 with linux LVM using new end... (7 Replies)
Discussion started by: alnhk
7 Replies

10. UNIX for Beginners Questions & Answers

Find and removing the old files and zipping the files using shell script

Hi, I am trying to removing the old files which were older than 10 days and same g zipping the files using the shell script. script was return as follows. find /jboss7_homes/JBOSS7/SKYLIV??/SKYLIV??_CRM/jboss-eap-7.0/standalone/log -mtime +10 -type f | xargs rm -f find /cer_skyliv??/log... (6 Replies)
Discussion started by: venkat918
6 Replies
fdmns(4)						     Kernel Interfaces Manual							  fdmns(4)

NAME
fdmns - contains file domain names and devices DESCRIPTION
The fdmns directory ensures access to file domains by providing symbolic links to every volume in the file domain. The mkfdmn, rmvol, and addvol utilities automatically manage the fdmns directory. Each file domain is described by its own subdirectory within the fdmns direc- tory. Back up the fdmns directory structure regularly using the vdump utility or any other backup utility (dump, tar, cpio). If the contents of the fdmns directory are deleted or corrupted, restore the directory from your most recent backup tape. You must also restore the fdmns directory after installing a new version of the operating system. Always keep a hardcopy record of each file domain and its associated volumes in case a backup copy of the fdmns directory is unavailable. If you have a record, you can reconstruct the fdmns directory structure. The following is a sample fdmns directory: total 2 drwxr-x--- 2 root system 512 Nov 24 18:35 scratch/ drwxr-xr-x 2 root system 512 Nov 24 18:35 usr/ ./scratch: total 0 lrwxr-x--- 1 root system 10 Oct 23 15:13 dsk10c@ -> /dev/disk/dsk10c lrwxr-x--- 1 root system 10 Oct 24 11:33 dsk11c@ -> /dev/disk/dsk11c lrwxr-x--- 1 root system 9 Oct 13 18:29 dsk8c@ -> /dev/disk/dsk8c ./usr: total 0 lrwxr-x--- 1 root system 9 Oct 24 10:52 dsk2g@ -> /dev/disk/dsk2c lrwxr-x--- 1 root system 9 Nov 24 10:35 dsk9c@ -> /dev/disk/dsk9c RESTRICTIONS
Do not remove or modify the contents of this directory. If the fdmns file becomes corrupted, you can no longer access (or mount) any file- set in the file domains. SEE ALSO
advfs(4), vdump(8), mkfdmn(8), vrestore(8), showfdmn(8) fdmns(4)
All times are GMT -4. The time now is 12:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy