LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 09-11-2013, 10:27 AM   #1
sras
Member
 
Registered: Jul 2013
Posts: 31

Rep: Reputation: Disabled
Print the files that are deleted successfully


Hello Guys.

how to print the list of files that are deleted successfully from the command below.

find / -name "*log*" -type f -exec rm -f '{}' \;

Thanks.
 
Old 09-11-2013, 11:10 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Add -print:
Code:
find / -name "*log*" -type f -exec rm -f '{}' \; -print
 
1 members found this post helpful.
Old 09-11-2013, 03:18 PM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
Originally Posted by sras View Post
find / -name "*log*" -type f -exec rm -f '{}' \;
Ouch, a great command when run as root if you want to brick your OS ...

Removing login, dtlogin, gdmlogin, logname, syslogd, zlogin, sulogin is not a smart idea.
 
Old 09-11-2013, 11:10 PM   #4
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
Quote:
find / -name "*log*" -type f -exec rm -f '{}' \;
Are you pretty sure you want to remove all said files in the above post, I guess no!!

You may be trying to remove log files ... but that will also a bad dream if executed with something like this "*.log"

So when you trying to delete files with a pattern always make sure you are specifying the correct location.
 
Old 09-12-2013, 03:26 AM   #5
sras
Member
 
Registered: Jul 2013
Posts: 31

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by colucix View Post
Add -print:
Code:
find / -name "*log*" -type f -exec rm -f '{}' \; -print
Worked Exact! Thanks you.
However I'm going to delete only "*log" files
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to recover files if accidentally deleted files in mysql Majed17 Linux - Software 3 03-02-2013 09:34 AM
Deleted files on a SMB-share - Files gone, space still allocated - Fedora 10 Zwentendorf Linux - Server 4 03-01-2009 05:04 AM
Cannot su to root successfully / Cannot copy/move *.bz2 files from Sosreport jbottiger Linux - Newbie 17 02-06-2009 09:28 AM
Mepis, copy files to thumb drive, files deleted? vremenno Linux - Newbie 6 09-15-2006 11:21 PM
How to delete the destination files while the source files deleted in cp -u ? myunicom Linux - General 4 09-26-2003 01:13 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 07:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration