elwayisgod
asked on
How to put a directory structure into a .txt file
I have a directory:
/essbase/app/alloc/alloc
/essbase/app/alloc/test
/essbase/app/test/user
/essbase/app/z_itgis/z_tes t
How do I script up a way to create a text file that will be:
alloc,alloc
alloc,test
test,user
Thus it dynamically reads anything after the /app, then puts the first directory in the first column, then the second in the second column. If there is multiple subdirectories after the /app then it just builds new lines for each one. Then it just keeps going until it no more directories exist in the /app directory. It ignores all directories that begin with 'z_' .
Thanks,
Sam
/essbase/app/alloc/alloc
/essbase/app/alloc/test
/essbase/app/test/user
/essbase/app/z_itgis/z_tes
How do I script up a way to create a text file that will be:
alloc,alloc
alloc,test
test,user
Thus it dynamically reads anything after the /app, then puts the first directory in the first column, then the second in the second column. If there is multiple subdirectories after the /app then it just builds new lines for each one. Then it just keeps going until it no more directories exist in the /app directory. It ignores all directories that begin with 'z_' .
Thanks,
Sam
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It's not a problem if you install UnxUtils: http://unxutils.sourceforge.net/
It's a set of unix utilities for Windows (very lightweight, not a cygwin).
basename, dirname, sed and awk are all there
It's a set of unix utilities for Windows (very lightweight, not a cygwin).
basename, dirname, sed and awk are all there
The above perl code works in either Unix or Windows
ASKER
C:\essbase\app\alloc\alloc
C:\essbase\app\alloc\test
C:\essbase\app\test\user
C:\essbase\app\z_itgis\z_t
Sorry, just came from Sun to a windows environment. Thus the problem.
Sam