How do I create a list of subdirectories over all mounted drives in terminal?
I'm busy debugging a Lua script for Moho. It is a search script to relink media files in a Moho project file. It seems to work well in Windows, but the script author hasn't access to a Mac computer for debugging. I've removed three bugs already, but now I'm stuck, because I lack sufficient knowledge of BASH.
I want to create a list of subdirectories over all mounted disks (including the boot disk), so the script can process it. I need a command to output this list, so I can capture it in a temporary file (using "> mohodlst.dat").
I want to create a list of subdirectories over all mounted disks (including the boot disk), so the script can process it. I need a command to output this list, so I can capture it in a temporary file (using "> mohodlst.dat").
Comments
find / -type d
Replace "/" with a more specific path to restrict find to looking in that directory. You can also search for a directory with a specific name by adding a "name" criterion (with or without wildcards):
find /Users/SomeUser/ -type d -name "somename*"
Find's default output is probably exactly the format you want, a simple list of the paths to all matching files/directories, one path per line.
If you're interested, here is the discussion on the Moho forum that covers my little project:
Moho General Forum - Exchanging moho files with intact image links
Edit: Unfortunately, "find" proved not to be compatible with the script (it was written with Windows in mind and Unix support was added without testing). So I had to revert to
ls -RF1
and filter out everything but the subdirectory entries (ends with a colon ":").
I could rewrite the script, but then I would have the problem optimizing it for WinXP (which I don't have). I also couldn't test for Linux.