× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



What’s the best way to create a directory tree on the IFS when only some, but perhaps all, of the directory entries exist?

Suppose that the final directory & file will look something like:

/home/PDF/username/2010/03/21/A Report.pdf

I know the /home/PDF/ directory exists, but the username directory may need to be created, as might the 2010 directory, or 03 or 21 before we actually create the .pdf file.

Is the best way to work backwards a directory at a time checking if it exists, then start building forward from there?

In the above example, if only /home/PDF/username/2010/ exists:
Check first for /home/PDF/username/2010/03/21/.
If that doesn’t exist, check for /home/PDF/username/2010/03/.
If that doesn’t exist, check for /home/PDF/username/2010/.
When /home/PDF/username/2010/is found:
Create /home/PDF/username/2010/03.
Create /home/PDF/username/2010/03/21/.

My initial thought is the QHFCRTDR API, which can create only one directory level at a time and caused the above rumination. I’m wondering if there is a better or easier way. Not considering high volume needs, but elegant and easy to use would be nice.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.