I have the following question.
Is it possible to see all files of a folder and all folders below it, for example in a new Finder window in a flat structure without moving files.
(In Total Commander (Windows) the command Tree View (CTRL+B))
The trigger is e.g. right-click and choose a quick task or selecting the folder and a keystroke.
I don’t know a KM way of doing this, but it seems like you could do a Spotlight search and tell it to just show you documents and not folders and it would give you what you’re looking for.
It is not clear if you just want a list of file names in your folder hierarchy, or if you actually want a new Finder folder with aliases to all of the files.
Here is an EXAMPLE to will produce just a list of file names in the Parent folder, and all sub-folders. I makes uses of the Bash find Command.
Example Output
Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
@tjluoma, you're the shell script expert here. So, if you have the time and interest, I'd appreciate it if you could review the Bash script I used above to see if there are any issues and/or improvements you'd suggest.
#IFS=$'\n'
{ read myFolderToSearch; read myRootFileName; read myFileExt; }
parentFolder=$myFolderToSearch
# --- DEFAULT VALUES If NOT Passed Via stdin ---
myFolderToSearch=${myFolderToSearch:-~/Documents}
myRootFileName=${myRootFileName:-*}
myFileExt=${myFileExt:-*}
# --- Expand Tilde in Path if It Exists ---
myFolderToSearch="${myFolderToSearch/#~/$HOME}"
echo Parent Folder: "$parentFolder"
echo
find -s "$myFolderToSearch" -type f -name "$myRootFileName.$myFileExt" -name "[!.]*"
# --- Additional Parameters Your Can Use ---
# ADD -name "[!.]*" to exclude HIDDEN files (begin with a dot)
# ADD -maxdepth 1 to limit to Parent folder
Note that I broke it into two lines for readability. The \ after -type f tells the shell that the next line continues the command. If you put it all on one line you can (and should) just remove that \ but don't remove the other ones that are not at the end of line.
Since I, too, am not certain if I'm properly understanding the goal, this may or may not be helpful. There is a built-in Mac command for revealing the contents of folders displayed in a Finder window.
With a Finder window open and set to List View (View > As List), select the desired folders (or all window contents using Command-A), then press Option-[right arrow]. This will expand all folders and their subfolders, thus showing all folder contents. To reverse this—also known as collapsing folders—press Option-[left arrow].
Note, to just expand all selected folders but not subfolders, skip the Option key and use only [right arrow].
First of all, thank you all very much for your answers.
I found a workaround myself: I go to a folder and make a new smart folder. As the search argument I take a point and then I have 99.9% of the files. I miss only the files with a '.'.
This view is what I meant my my perhaps somewhat unfortunate and not fully formulated question.
Now it might be possible to make a solution with KM so that I can toggle between the tree view and the flattened view with a key combination?