Removing Old Log Files on Mac OS

Sometimes we need to clean up our systems and a great place to start with is our Log directory. This can be filled with logs from old versions of applications, wether you no longer use the application or the application has updated itself overtime. Let's get rid of these old files! ... BUT let's not get rid of the ones that MIGHT matter to us. In this case, we may only want to purge logs older than 7 days. To do that, we want to set our find command to only remove those older files. We can do that by running this command in the terminal:

find /Users/cj/Library/logs -mtime +7 -exec rm -f {} \;

Next, we will probably end up with a bunch of empty directories. Let's get rid of those too, but to be on the safe side lets list all of the ones we are gonna delete first:

find /Users/cj/Library/Logs -type d -empty -print

Now that we are sure we want to delete all of those directories, let's go ahead and purge them:

find /Users/cj/Library/Logs -type d -empty -delete

 


Home Office

Cherry Hill, NJ

North New Jersey Office

Hasbrouck Heights, NJ

Philadelphia Office

Media, PA

office Hours

Mon - Fri : 8am to 6pm

Social Media