Sponsored Content
Top Forums Shell Programming and Scripting Remove directory with exceptions Post 302376157 by rdcwayx on Monday 30th of November 2009 06:58:05 PM
Old 11-30-2009
What's the meaning to put a * in your find script?

your request can be combined into one command:

Code:
find . ! -name "*.SYNC" -type f -exec echo rm -rf {} \;

if you review the output, and it is fine, then run below command to delete files.

Code:
find . ! -name "*.SYNC" -type f -exec rm -rf {} \;

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

smitty, remove user, remove directory as well..

hi, i am on aix. i used smitty to remove a user.. but then found that its directory still exists.... so i have to remove the directory manually... am i doing it the right way? (2 Replies)
Discussion started by: yls177
2 Replies

2. AIX

remove hardlink directory

I have to move a lpar from one 671 to another (aix 5.2 ML 07) when I run mksysb, It alway hangs with "archieving file list" I've tried to exlude every directory, but still not working the only thing that can be a problem, is a hardlink directory normally it should not be possible to... (4 Replies)
Discussion started by: funksen
4 Replies

3. Shell Programming and Scripting

exceptions in import

Hello, I want to import an Oracle database file on my fresh DB, bought before successfully with exp command. But is it possible to import some tables from the dmp file, because they are too large and it's so long !? I didn't find any option in imp command to make exception on certain tables...... (1 Reply)
Discussion started by: madmat
1 Replies

4. Solaris

Can't remove a directory

Hello, somehow a directory called -r was created on one of my servers and I can't remove is using either rm or rmdir. Is there a way to remove this directory? Thank you. -David (2 Replies)
Discussion started by: dkranes
2 Replies

5. Shell Programming and Scripting

Remove contents of directory, but not directory

What's the best way to delete everything in a directory, but not the directory itself, without using shell wildcards? (9 Replies)
Discussion started by: pdc
9 Replies

6. UNIX for Advanced & Expert Users

Remove directory with exceptions

Hi, I want to remove a directory recursively except the inside directories calles .SYNC (designsync dirs) I am looking for something like: \rm -rf < find . * | grep -v .SYNC The find works ok but I do not know how to redirect it. Please help. Regards, Ziv:rolleyes: (1 Reply)
Discussion started by: zivsegal
1 Replies

7. Shell Programming and Scripting

Remove Directory

By Mistake i created a directory named "-lrt" in one of my working directories and now i am not able to delete it , please suggest hw to delete this directory now ? Thanks in advance. (1 Reply)
Discussion started by: neeraj617
1 Replies

8. Shell Programming and Scripting

Wildcards and exceptions

Hello: I have a very basic question. I'd like to select all files except for one file. For example, say I want to move all of the files in my current directory to a subdirectory called archive, I would use mv ./* archive/ But what if I want to move all files except for README.txt? Is there an... (19 Replies)
Discussion started by: Danny.Boy
19 Replies

9. Shell Programming and Scripting

RegEx with exceptions

I am totaly new to RegEx, but I need to extract emails with RegEx from text file Some difficulties: 1. “@”symbol has been substituted for “ at ”,"AT" or "(at)" 2. I do not need any email with domain "myoldcompany" I found that with these I can found any emails: "^+@+\.+$" How to do... (1 Reply)
Discussion started by: AIX_30
1 Replies

10. HP-UX

Directory can't remove!

Hello my friends, I have a directory called log_old when I try to delete it, it tells me no such file or directory. Then I tried to run this command: ls -lb It tells me the directory name, it is: log_old1\177 !! I tried to remove it using inode, using this... (4 Replies)
Discussion started by: Mohannad
4 Replies
SYNC(1) 							   User Commands							   SYNC(1)

NAME
sync - Synchronize cached writes to persistent storage SYNOPSIS
sync [OPTION] [FILE]... DESCRIPTION
Synchronize cached writes to persistent storage If one or more files are specified, sync only them, or their containing file systems. -d, --data sync only file data, no unneeded metadata -f, --file-system sync the file systems that contain the files --help display this help and exit --version output version information and exit BUGS
Persistence guarantees vary per system. See the system calls below for more details. AUTHOR
Written by Jim Meyering and Giuseppe Scrivano. REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report sync translation bugs to <http://translationproject.org/team/> COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
fdatasync(2), fsync(2), sync(2), syncfs(2) Full documentation at: <http://www.gnu.org/software/coreutils/sync> or available locally via: info '(coreutils) sync invocation' GNU coreutils 8.28 January 2018 SYNC(1)
All times are GMT -4. The time now is 08:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy