If you don't mind having a trailing backslash printed with your directory names, the trivial way to do it is:
printf '%s\n' /a/b/c/home??/*/
If you do mind the trailing backslash, you can use a for loop on the same pathname pattern and print the loop control variable with the backslash stripped off.
Of course, how you put the results into an excel spreadsheet is up to you.
Nice to see you again in forum. Could you please try following and let me know if this helps, I have made a similar directory structure in my /tmp and tried following command, you can replace the path with your actual and path and if happy with results then re-direct it's output to an excel file too.
Hi Ravinder, thanks for the code, I tried your code, I know its a correct one but ksh shell is not able to recognize maxdepth and mindepth options of find command.
Unless your version of the Korn shell has find as a built-in, the issue isn't ksh , but the version of find you're using. And, since you didn't bother telling us what operating system you're using, RavinderSingh13 supplied a sample script that works on the system he's using without worrying about options that might not be available on your unnamed system.
The code I suggested should work with ksh on any system (unless you have a huge number of matching directories and/or relatively long pathnames). And, if that is a problem in your environment, it would disappear if you used the for loop I suggested.