Sample Header Ad - 728x90

Print only files, directories containing files and empty directories

0 votes
1 answer
173 views
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.
Asked by norglis (1 rep)
Aug 28, 2020, 10:21 PM
Last activity: Aug 29, 2020, 09:39 PM