how to read, change, and write macOS file alias from python

前端 未结 2 1510
暖寄归人
暖寄归人 2021-01-13 21:28

Is there any way to read a macOS file alias, modify its contents (particularly the target file path), and write the modified alias back out?

For example, if I have t

2条回答
  •  旧时难觅i
    2021-01-13 21:52

    This thread got my interest...

    But I don't think it's possible.

    Look at this bug report in mac_alias: https://github.com/al45tair/mac_alias/issues/4

    it notes that the package handles Alias records not Alias files. The Alias files are a 3rd version which hadn't been reverse engineered yet.

    It points to this info on the Alias file: http://indiestack.com/2017/05/resolving-modern-mac-alias-files/

    Also this thread on their old bitbucket: https://bitbucket.org/al45tair/mac_alias/issues/3/support-for-version-3-aliases

    which points this dead page (thanks, archive.org) https://web.archive.org/web/20170222235430/http://sysforensics.org/2016/08/mac-alias-data-objects/

    and info that reading some information is possible via this package: https://pypi.python.org/pypi/plistutils/ which has a bunch of docs on reading alias structures on their github

    none of this does what you want though. sorry.

提交回复
热议问题