File or Folder Efficiency?

I've got this program set up so that it creates files whose unique names specify the jobs their contents describe. In order to retrieve the information inside those files, I have to do a "grep" and awk or sed to extract it. I've just assumed that making a directory with that unique name that contains individual files for each type of information rather than lines inside the files I'm referring to would be wasteful of storage and slower to retrieve. I realize now that I've only assumed this and was not sure.

How would the method of having a thousand or so directories with individual files inside each to contain several types of information compare to my current method of files with those same unique names containing fields to be extracted from those files?

Would getting the file inside a directory be less resource/time intensive than having to extract each piece of info from a single file with that unique name?

It'd probably be better to not proliferate clutter that way.

How efficient the awk/grep method works depends on how large the files are, and how you're using them.

1 Like