LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-17-2014, 10:56 AM   #1
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 236

Rep: Reputation: Disabled
Trouble finding correct folder


I am trying to delete certain files that have "this-data" within. These files are located in folders 0-9, A-Z in a folder called /var/spool/postfix/deferredtemp. The folders within the /deferredtemp can vary in number, right now they are 0-9 plus A-E. I am finding the files ok with the grep instruction, but the rm doesn't work. I am guessing that the rm is looking for the files in /deferredtemp/ rather than /deferredtemp/E/.

Test to see if finding data ok:
grep -r "this-data" /var/spool/postfix/deferredtemp/*
Binary file /var/spool/postfix/deferredtemp/E/0058F8071A matches

Test to remove file:
grep -r "this-data" /var/spool/postfix/deferredtemp/* | xargs rm
rm: cannot remove `Binary': No such file or directory
rm: cannot remove `file': No such file or directory
rm: cannot remove `matches': No such file or directory
 
Old 06-17-2014, 11:06 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,575

Rep: Reputation: 938Reputation: 938Reputation: 938Reputation: 938Reputation: 938Reputation: 938Reputation: 938Reputation: 938
Code:
man grep
And you would have found:

Code:
       -l, --files-with-matches
              Suppress  normal  output;  instead  print  the  name of each input file from which output would normally have been printed.  The
              scanning will stop on the first match.  (-l is specified by POSIX.)
 
Old 06-17-2014, 11:22 AM   #3
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 236

Original Poster
Rep: Reputation: Disabled
Yes. I tried that also, but when I got this message:

grep: /var/spool/postfix/deferredtemp/0: Is a directory

I though that it didn't work. Actually it did.

grep -l "ixazon.dynip.com" /var/spool/postfix/deferredtemp/* | xargs rm
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
KPackageKit not finding correct IP address leongoogs Linux - Newbie 5 08-21-2010 03:45 AM
Compiling in any folder will install in current or correct folder ? anjanesh Fedora 4 05-10-2006 09:44 AM
Iptables - Finding the correct way? muppski Linux - Networking 1 07-18-2005 09:14 AM
Finding Correct Moniter Settings jakobie Linux - Hardware 4 11-29-2004 12:28 PM
Trouble finding correct alsa driver to use for Intel chipset Gates1026 Linux - General 1 02-19-2004 01:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:44 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration