Looking to format a -print string to fit to everythings time format (Now for Mac OS)

General discussion related to "Everything".
Post Reply
luckulucki
Posts: 65
Joined: Mon Jun 19, 2017 1:45 pm

Looking to format a -print string to fit to everythings time format (Now for Mac OS)

Post by luckulucki »

Coming from here, where I got a great help for formatting a timestamp on a linux machine.
NotNull wrote: Sun Jun 11, 2023 9:29 pm When using Linux' find command, this should do:

Code: Select all

find.exe -printf '"%p",%s,%TFT%TT,,\n'
Which generates output like

Code: Select all

"./Everything64.exe",4798984,2023-05-26T07:04:38.5761116000,,
(Date Created and Attributes are not available in LInux so those are left blank)

And when saved as an EFU file, Everything will be able to read and understand it, after adding the Filename,Size,Date Modified,Date Created,Attributes header.
Now, I'm on a Mac OS machine and the Apple find can not use printf.

I have tried hours and spent a lof of time chatting with ChatGPT to help me converting that linux find to a mac find with the same output, but failed miserable. (I spare you all my tries and errors...)

All I got, was the "stat" command from mac to show me that all the needed information are available:

Code: Select all

stat /tmp/test.txt
16777220 13001552577 -rw-r--r-- 1 user wheel 0 103944533 "Aug  3 19:27:25 2023" "Aug  3 19:27:36 2023" "Aug  3 19:27:36 2023" "Aug  3 13:13:18 2023" 4096 229384 0 /tmp/test.txt
But I couldn't get them to work with the find command to get a decent output. :-(

Maybe here is some Mac Master which can tell me, how to format the Linux string to a Mac string?

Any Help is needed ;-D Thank you!
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Looking to format a -print string to fit to everythings time format (Now for Mac OS)

Post by NotNull »

Can't help you this time (I am incompatible with anything Apple), but MacOS is build on BSD Unix. Not Linux.

You might want to look at the stat man-pages.
Especially the -f (format) and -t (timeformat) should help you to bget closer.

Timeformats on BSD


Look closely at the "" quoting; very important here
Post Reply