Sample Header Ad - 728x90

How to display file and folder properties from search

1 vote
1 answer
496 views
I thought this would be easy and there are a lot of somewhat close threads on the internet, but nothing quite right. I want to use fd (simple find command) to display just file name and file size (preferably in mb, or formatted more readable than bytes), of the search results. The closest I have come is using: fd '2023' -x stat --format='%n : $s' This seems to work okay for files, but doesn't work for directories. E.g. fd --type d '2023' -x stat I tried playing pipes | and tee and xargs. But being a novice, I didn't have any luck. Any ideas how I can display the output for files and folders and how can I format the bytes to the appropriate units? Thanks
Asked by 1toneboy (465 rep)
Jun 4, 2023, 02:20 AM
Last activity: Jul 26, 2024, 09:00 PM