Skip to content

python script for making a specific cli command preserve xAttr (extended File Attributes) of all filles it operates on

License

Notifications You must be signed in to change notification settings

vincemann/x-attr-preserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

X-attr-preserver

Simple python script for making a specific command-line program preserve xAttr (extended File Attributes)
of all files given as an commandline-argument to it.

Usage:

  • create a backup of your .bashrc file before using with cat ~/.bashrc > ~/.bashrc.bak
  • python3.5 makePreserveAttr.py <absolute/Path/To/Program>
  • the specified program must be in your PATH
  • restart your terminal so the changes take place

Example:

  • python3.5 makePreserveAttr.py /usr/bin/vi
  • now vi testFile.txt wont remove the extended File Attributes of testFile.txt anymore

How it wokrs:

  • Creates an alias of the programname in your .bashrc running a bashfunction instead of the original program.
  • The bashfunction saves the xattributes of all files, given as an commandline-argument to the program, to tempfiles.
  • The bashfunction will then run the original program and restore all saved xattributes.

Requirements:

  • Python3.5,
  • clitools: getfattr, setfattr (install with: sudo apt install attr)

About

python script for making a specific cli command preserve xAttr (extended File Attributes) of all filles it operates on

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages