LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 09:56 AM   #1
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 258

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, 10:06 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,469

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
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, 10:22 AM   #3
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 258

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

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

All times are GMT -5. The time now is 03:52 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
Open Source Consulting | Domain Registration