I'm trying to find any files on a specific mount that are older than one year and do not belong to a specific user. This is the command I'm using (within the root directory of the mount):

find . ! -user username -mtime +365 -type f | xargs ls -al > /tmp/list

I'm piping this through xargs because I need to know the absolute path and size for each result. I do get results, but a number of files seem to be missing.

Could someone give me a hand? What am I missing?

  • The command looks OK to me. But doesn't the -ls option to find show the full path and size?
    – Barmar
    Dec 30, 2014 at 20:04
  • Or -printf "%p %s\n"
    – muru
    Dec 30, 2014 at 20:05
  • 2
    Do the files that are missing have anything in common? xargs will have problems with files that have whitespace in their names. Use find -print0 and xargs -0 to deal with that. The -ls option also won't have a problem.
    – Barmar
    Dec 30, 2014 at 20:07
  • Thanks guys.. I think that the issue was indeed whitespace. Using the -ls option is working great for my purposes.
    – Mikey
    Dec 30, 2014 at 20:29

1 Answer 1


Although it's not exactly the same thing as piping to xargs ls -al, the -ls flag of find itself might be enough for your and simplify the command a bit:

find . ! -user username -mtime +365 -type f -ls > /tmp/list

If you think a file is missing, look at what stat says about it. Keep in mind that -mtime is a condition concerning modification time. There's also inode change time, and access time.

  • 1
    Most Unix filesystems don't have creation time. There's access time, modification time, and inode change time.
    – Barmar
    Dec 30, 2014 at 20:05
  • Fantastic. I'm not sure exactly what about piping everything through xargs was messing up the process, but your command did the job perfectly. Thanks, @janos!
    – Mikey
    Dec 30, 2014 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.