A few days ago I was working on my blog leonardomontini.dev as I'd like to give it a strong restyle and move from Gatsby to Astro.
I also took the chance to change the folder structure of the current blog as it's now flat and I wanted a more organized one.
Not too complicated, I wanted to group for
month folders and move all the posts in the right one. For example, the post
2023-04-30_my-post/index.md should be moved to
There are ~50 articles right now, such a boring task to do manually and since it's just a simple files/folders manipulation I thought a simple bash script could have been the solution... but it's 2023, I didn't want to write it myself and Google for the right commands when I can just ask an AI to write a wrong script for me :D
I've recently got access to the Copilot CLI beta and I'm playing with it to see how it works but this seems like a real use case for it.
I actually didn't plan to make a video out of it but I thought the process could have been interesting to share so I quickly turned on the lights, the webcam and started recording.
This is how it went:
Spoiler: it didn't work on the first attempt, but it was definitely my fault for not noticing the error in the suggested script
Running a script generated by an AI if you have no idea what is it going to do isn't probably a wise choice, even if you can ask the AI to explain it. In my case, the task was quite simple and the outcome was easy to verify so it was a safe playground.
Actually, as you can see in the video, I was in a temporary folder AND I had an extra backup on a zip file. Better safe than sorry!
Are you using AI tools for generating scripts for you? Only easy scripts or also more complex ones?
What questions are you asking or what problems are you solving with them?
Let me know in the comments! :D
Thanks for reading this article, I hope you found it interesting!
I recently launched my Discord server to talk about Open Source and Web Development, feel free to join: https://discord.gg/bqwyEa6We6
Feel free to follow me to get notified when new articles are out ;)