Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Here are the specs: Find all files in / modified after the modification time of /tmp/test, exclude /proc and /sys from the search, and print the full path of the file along with human readable size. Here is what I have so far:

find / \( -path /proc -o -path /sys \) -prune -o -newer /tmp/test -exec ls -lh {} \; | less

The issue is that the full path doesn't get printed. Unfortunately, ls doesn't support printing the full path! And all solutions I have found that show how to print the full path suggest using find. :|

Any ideas? Thanks!

share|improve this question
add comment

2 Answers

Instead of -exec ls -lh {} \; you can also use the printf option:

find / \( -path /proc -o -path /sys \) -prune -o -newer /tmp/test -printf "%s %p\n" | less

Although that will just print the size in bytes and not in the nice human-readable format ls supports.

share|improve this answer
1  
+1 for POSIX and non-ls solution. –  l0b0 Jun 25 '13 at 7:55
add comment

Add -d to the ls command.

find / \( -path /proc -o -path /sys \) -prune -o -newer /tmp/test -exec ls -lhd {} \; | less

That will also fix the problem you were bound to have with files showing up twice in your list.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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