I’ve tried various versions of these:

FILENAME has spaces

touch -d "$(stat 'FILENAME' | grep -oP 'Birth:\s+\K\d{4}\-\d{2}\-\d{2}' | sed 's/^/"/;s/$/"/')" $(echo 'FILENAME' | sed 's/^/"/;s/$/"/')

FILENAME has no spaces

touch -d "$(stat 'FILENAME' | grep -oP 'Birth:\s+\K\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}' | sed 's/\-//g;s/://g;s/ //')" "FILENAME"

the former returns error about wrong time format.

the latter ended up setting the mtime date to May 10 2446 (at least the millennium is right…) i can’t even figure out how the numbers would rearrange/misread to get that from desired Jan 6 2025. So i assume it was read as some kind of offset from 1970 but I don’t know enough to use that info to my advantage.

when i echo the commands, the formatting and syntax seems to match examples in the web. so I’m lost.

and I can’t seem to find specific docs about touch vis-à-vis what time format is accepted and details of syntax.

btw I’m ND, and can’t mentally process manpages docs, at least not dynamically enough to use the info in original or niche situations without also having stackoverflow or other q&a pages with directly relevant examples. ND/OCD is also why i need to sort files by mtime specifically. “just sort it by ctime” is not an option.

anyone who replies, thank you very much.