⭐ in reply to How do I get all the permission flags on a file?
You don't need octal, ever. You need a number. That number from stat can be handed over directly. For safety, you may want to bit-and it with 07777, but I don't think there'll be any
nonsense anyway.