I need to find a folder nested in a folder.
example:
/Volumes/"4T Virtual Machines"/outerfolder/innerfolder
mac $ pwd
/Volumes/4T Virtual Machines
mac $ ls -lR outerfolder/
total 0
-rw-r--r-- 1 mac staff 0B Aug 28 18:02 file1
-rw-r--r-- 1 mac staff 0B Aug 28 18:02 file2
drwxr-xr-x 5 mac staff 170B Aug 28 18:04 innerfolder/
drwxr-xr-x 3 mac staff 102B Aug 28 18:07 otherfolder/
outerfolder//innerfolder:
total 0
-rw-r--r-- 1 mac staff 0B Aug 28 18:04 aaa
-rw-r--r-- 1 mac staff 0B Aug 28 18:04 bbb
-rw-r--r-- 1 mac staff 0B Aug 28 18:04 ccc
outerfolder//otherfolder:
total 0
-rw-r--r-- 1 mac staff 0B Aug 28 18:07 justskip
mac $
Let's have two cases the outerfolder is at the root of the external drive and the outerfolder isn't at the root of the external drive. I should be able to modify one solution to the other.
I'm writing in applescript on macOS yosemite or later, but potentially invoking a Unix command from applescript. So the solution may be in all applescript or Unix command called from applescript. The Unix command approach
Here is the Unix command I have for finding the outer folder:
find /Volumes -type d -maxdepth 1 ! -name Volumes -exec find {} -type d -maxdepth 1 -name "Virtual Box" \;
I tired a third nested find, but errored out
find /Volumes -type d -maxdepth 1 ! -name Volumes -exec find {} -type d -maxdepth 1 -name "Virtual Box" -exec find {} -type d -maxdepth 1 ! -name inner \;
find: -exec: no terminating ";" or "+"
find: -exec: no terminating ";" or "+"
find: -exec: no terminating ";" or "+"
mac RC=1 😱 $
innerfolder
which is directly withinouterfolder
, right?