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,648
  • 8
  • 20
0

What i would do :

find . -type f -exec du {} \; | sort -n | awk 'END{$1=""; print}'
Inian
  • 71,145
  • 9
  • 121
  • 139
Gilles Quenot
  • 154,891
  • 35
  • 213
  • 206