I have the following folder structure:
├── longdirectorywithsillylengththatyouwouldntnormallyhave
│ ├── asdasdads9ads9asd9asd89asdh9asd9asdh9asd
│ └── sinlf
└── shrtdir
├── nowthisisalongfile0000000000000000000000000
└── sfile
I need to find files and folders where their names length is longer is than x characters. I have been able to achieve this with:
find . -exec basename '{}' ';' | egrep '^.{20,}$'
longdirectorywithsillylengththatyouwouldntnormallyhave
asdasdads9ads9asd9asd89asdh9asd9asdh9asd
nowthisisalongfile0000000000000000000000000
However, This only outputs the name of the file or folder in question. How can I output the full path of resulting matches like this:
/home/user/Desktop/longdirectorywithsillylengththatyouwouldntnormallyhave
/home/user/Desktop/longdirectorywithsillylengththatyouwouldntnormallyhave/asdasdads9ads9asd9asd89asdh9asd9asdh9asd
/home/user/Desktop/shrtdir/nowthisisalongfile0000000000000000000000000