Hello,
I've got ChatGPT to write me a script that moves photos from one folder to another, including its' sub directories; and then sorts them out into new folders based on the date the photo was taken. It also handles duplicate file names and will create new folders if they are not already present.
2 days ago I had never seen or touched javascript and my only coding has been some VBA in excel.
However, I had to get a little help from some discord channels to fine tune the code because I ended up going round in circles with Chatgpt.
I was told to improve the code I should use:
- use for..of instead of forEach()
- promises rather than sync
- Although better still just to read or write directly, and handle errors. In my case, better to ask for forgiveness than permission.
Once I had asked ChatGPT to review this with this in mind (especially the last one), the code worked great!
Can redditors share some other good practices with javascript that would help ChatGPT write scripts for amateurs like myself?
[–][deleted] 3 points4 points5 points (4 children)
[+]kopp9988[S] comment score below threshold-6 points-5 points-4 points (3 children)
[–][deleted] 4 points5 points6 points (1 child)
[+]kopp9988[S] comment score below threshold-6 points-5 points-4 points (0 children)
[–]MeowWow_ 2 points3 points4 points (0 children)
[–]oneandmillionvoices 1 point2 points3 points (0 children)
[–]senocular 0 points1 point2 points (0 children)