Shell Script to Rename Folder and Create New Folder

Hello all. I’m looking for a little guidance for an idea I have that is pretty straightforward I think but I’m not overly familiar with scripting.


I’m thinking of a shell script (I can use launchd to run on a monthly basis) that takes folder

`/Users/nathan/Kometa/config/assets`, rename it to `/Users/nathan/Kometa/config/assets2` (leaving contents intact), then recreates the empty original assets directory. How would I go about that?


What does “monthly” look like in terms of a launchd calendar interval?


Thanks!

Mac mini, macOS 14.7

Posted on Feb 27, 2025 09:33 PM

Reply
2 replies

Feb 28, 2025 07:06 AM in response to rothnd

I think I've got the bones. Basically a sh that mv assets assets2 then mkdir assets. Run on a launchd Day1, Hour1, Min1 (every month on the first at 1?).


Question now is I would like to incorporate some level of, simple, logging of this script just so I can see when it ran, what it ran, etc. But I have 0 experience with logging, could use some help there.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Shell Script to Rename Folder and Create New Folder

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.