Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

breather

macrumors 6502
Original poster
Jan 26, 2011
422
1,736
Sweden
I'm want this.

I want a list of all the folder names in a folder to be copied and pasted into a .txt document every time there is change (something removed/added/edited) to the folder contents.

Alternatively that a copy is being made like once a week, once a day (an interval of my choosing).

I'm thinking this could maybe be possible with Automator (and maybe Apple Script together)?
My knowledge of these things isn't that great and I would appreciate some help.

Maybe there is another way (doing it myself by hand is not an alternative)?

Thanks
 

Slartibart

macrumors 68030
Aug 19, 2020
2,894
2,601
open a terminal. type cd and drag and drop the folder which contains the folders you want to list on the terminal window, then press Return. (inside the terminal window you should something like: cd path/to/the/root/folder/you/dropped/on/the/window)

to then list only the folders at the current path you can use

ls -d */

in the terminal.

use ls -d */ >./list-of-folders.txt to redirect the output into the file „list-of-folders.txt” inside the current folder.

You can use Automator to create a Folder Action which writes this text list whenever there is a change.

1684752526705.jpeg


Here is a guide how to integrate a shell script into Automator.
 

breather

macrumors 6502
Original poster
Jan 26, 2011
422
1,736
Sweden
open a terminal. type cd and drag and drop the folder which contains the folders you want to list on the terminal window, then press Return. (inside the terminal window you should something like: cd path/to/the/root/folder/you/dropped/on/the/window)

to then list only the folders at the current path you can use

ls -d */

in the terminal.

use ls -d */ >./list-of-folders.txt to redirect the output into the file „list-of-folders.txt” inside the current folder.

You can use Automator to create a Folder Action which writes this text list whenever there is a change.

View attachment 2205710

Here is a guide how to integrate a shell script into Automator.
Thank you. Will try this out when I get home in a few days.

Thanks again.
 

breather

macrumors 6502
Original poster
Jan 26, 2011
422
1,736
Sweden
Save Finder List.png
I ended up doing this which does what I wanted.
Listing things in a folder and putting out a txt file.
Everytime there is a change in the folder.

Thank you for putting me on the right path.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.