Skip to main content
Question

Script to collect a list of a specific folders contents?

  • August 9, 2016
  • 2 replies
  • 19 views

Forum|alt.badge.img+13

I was wondering if there is a script out there I could utilise, to list the file contents of
the users /library/LaunchDaemons /library/LaunchAgents /library/StartupItems

So that I can keep the startup items of users devices to a minimum, I hope to collect a list of plist files that don't need to be set for startup.

2 replies

Forum|alt.badge.img+8
  • Contributor
  • August 9, 2016

You could do something as simple as follows:

#!/bin/bash

ls /Library/LaunchDaemons > "Filename/Location" &&
ls /Library/LaunchAgents >> "Filename/Location" &&
ls /Library/StartupItems >> "Filename/Location"

This will collect the data from the command and put it to a text file if you name the file something like "dataoutput.txt" and you can specify save location too such as "/Users/$USER/Desktop/dataoutput.txt".


Forum|alt.badge.img+13
  • Contributor
  • August 10, 2016

I have the exact same question, though more specifically, I'd like to create an extension attribute which lists the contents of /Library/LaunchAgents, /Library/LaunchDaemons, /Library/Startupitems AND their counterparts in ~/Library. My intent is to use this data to look for the presence of Malware.