I am trying to index some LTO tapes (and some hard disks as well) and would like a simple output, stored in a text file. Something like the example below:
...
/home/norg/Desktop/empty\ dir/
/home/norg/Documents/file.txt
...
The "empty dir" folder is, of course, an empty folder. Notice how folders like "Desktop" and "Documents" are only printed because they have contents inside them. In other words, /home/norg/Desktop/
would never be printed, unless it were empty.
I've tried things like ls -RFad /home/norg/
and some find
syntaxes to varying success. The trickiest part is having the empty directories printed, but not the full ones. I hope this makes sense. Thanks.
Another thing to mention, I would really prefer this to work in one go, as I will be using this with tape and want to have as little reads as necessary to reduce wear.
man find
, an empty. directory is\( -type d -links 2 \)
– waltinator Aug 29 '20 at 01:37.
and..
? – waltinator Aug 29 '20 at 17:33.
and..
is definitely not granted by POSIX. – schily Aug 29 '20 at 18:01