Howdy, I am getting some errors with find and ls command - such that find is able to see a file whereas ls says the file doesn't exist. Initially I was trying find and ls together as: # find ./ -type f -mtime +15 | xargs ls Similar behavior is seen even when I execute both commands separately. Any thoughts on what might be wrong here? -- thanks, neubyr
Kahlil Hodgson
2011-Feb-24 05:03 UTC
[CentOS] ls returns file doesn't exist, find finds it??
On 24/02/11 15:54, neubyr wrote:> Howdy, > > I am getting some errors with find and ls command - such that find is > able to see a file whereas ls says the file doesn't exist. Initially I > was trying find and ls together as: > # find ./ -type f -mtime +15 | xargs ls > > Similar behavior is seen even when I execute both commands separately. > Any thoughts on what might be wrong here?white space or weird chars could be causing problems. try find ./ -type f -mtime +15 -print0 | xargs -0 ls Kal
On Wed, Feb 23, 2011 at 11:54 PM, neubyr <neubyr at gmail.com> wrote:> Howdy, > > I am getting some errors with find and ls command - such that find is > able to see a file whereas ls says the file doesn't exist. Initially I > was trying find and ls together as: > # find ./ -type f -mtime +15 | xargs ls >Instead of piping to xargs, try: find . -type f -mtime +15 -exec ls {} \;
Les Mikesell
2011-Feb-24 13:59 UTC
[CentOS] ls returns file doesn't exist, find finds it??
On 2/23/11 10:54 PM, neubyr wrote:> Howdy, > > I am getting some errors with find and ls command - such that find is > able to see a file whereas ls says the file doesn't exist. Initially I > was trying find and ls together as: > # find ./ -type f -mtime +15 | xargs ls > > Similar behavior is seen even when I execute both commands separately. > Any thoughts on what might be wrong here?Can you give an example of a path that find returns and the output of ls -l 'that_path_in_quotes' My first guess is that you have shell metacharacters (like spaces) in the file or directory names that the shell parses/expands if you don't quote them. Using the GNU --print0 extension to find and the matching -0 option to xargs might fix it. -- Les Mikesell lesmikesell at gmail.com
Brunner, Brian T.
2011-Feb-24 14:08 UTC
[CentOS] ls returns file doesn't exist, find finds it??
centos-bounces at centos.org wrote:> Howdy, > > I am getting some errors with find and ls command - such that find is > able to see a file whereas ls says the file doesn't exist. Initially I > was trying find and ls together as: > # find ./ -type f -mtime +15 | xargs ls > > Similar behavior is seen even when I execute both commands separately. > Any thoughts on what might be wrong here?Try: find ./ -type f -mtime +15 -print0 | xargs -0 ls Insert spiffy .sig here //me ******************************************************************* This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept for the presence of computer viruses. www.Hubbell.com - Hubbell Incorporated**