190
you are viewing a single comment's thread
view the rest of the comments
[-] talkingpumpkin@lemmy.world 2 points 20 hours ago* (last edited 20 hours ago)

IDK.

I just asked this to perplexity as an experiment:

write a macos terminal command that makes a backup copy if all files in documents/ my home adding the current date and time to each filename

Here's what it concocted:

cd ~ && find Documents -maxdepth 1 -type f -exec sh -c 'for f; do cp "$1" "Documents/$(date +%Y%m%d-%H%M%S)_$(basename "$1")"; done' _ {} +

Now, I am no "prompt engineer" and surely there are better way to ask it stuff, but then again a layman is no prompt engineer either.

So the question is: would a layman be able to provide feedback and have perplexity fix its command?

My "layman-like" feedback (now that I re-read it, IDK how much a layman would have used "recurse"... I'm doing my best here):

I want the files copied to a "backups" folder in my home. It should also recurse into the "documents" folder.

mkdir -p ~/backups && cd ~/Documents && find . -type f -exec sh -c 'mkdir -p "~/backups/$(dirname "$1")" && cp "$1" "~/backups/$2/$(date +%Y%m%d-%H%M%S)_$(basename "$1")"' _ {} "$(pwd)" \;

Feeback:

it says "No such file or directory" (because of $PWD passed as $2 - of course I didn't say this to the LLM)

mkdir -p ~/backups && rsync -a --include='*/' --include='*.*' --exclude='*' --no-links ~/Documents/ ~/backups/"$(date +%Y%m%d-%H%M%S)"/

the date must be in the file name

mkdir -p ~/backups && find ~/Documents -type f -exec sh -c 'dir="~ /backups/$(dirname "${1#"$2"}")"; mkdir -p "$dir"; cp "$1" "$dir/$(date +%Y%m%d-%H%M%S)_$(basename "$1")"' _ {} ~/Documents \;

I don't think I need to continue?

BTW: the LLM also instructed me to do a whole bunch of seemingly useless stuff, like giving Terminal.app full disk access via System Settings > Privacy & Security > Full Disk Access (which I assume is actually a thing in macos but can't verify as I run linux)

edit: I hope I didn't misinterpret the bash commands (I didn't actually run them) and spotted the right bugs in them - even if I didn't I guess my point still stands?

this post was submitted on 12 Jan 2026
190 points (94.8% liked)

Programming

24394 readers
312 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS