0

I need to find the largest file of chosen directory and sub-directories and print the path of that file

I can find the biggest file (I think so)

find . -type f | wc -l

However, I'm stuck on printing the path

2 Answers2

0
find . -type f | xargs ls -l | sort -nk 5 | tail -n1 | awk '{print $NF}'
Viktor Khilin
  • 1,760
  • 9
  • 21
0

What i would do :

find . -type f -exec du {} \; | sort -n | awk 'END{$1=""; print}'
Inian
  • 80,270
  • 14
  • 142
  • 161
Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223