Recursively scans all files, directories and symlinks inside a specified directory, and exports various attributes about them in JSON format with GZIP compression.
./backup-file-attributes.py scan_dir output_file.gz
Warning: If the output file already exists, it will be replaced without notice.
To be done (this hasn't been implemented yet).
Data is exported in JSON format with GZIP compression. For each file, directory or symlink, a JSON object with the following information is saved:
filename
(string): File's name, without the path.ctime
(int or float): Creation timemtime
(int or float): Modification timemode
(int): Read/write/execute permissionsuser
(string): Name of the user who owns this itemgroup
(string): Name of the group who owns this itemtype
(string): 'file', 'dir' or 'symlink' depending on what type of item this is- [Only on directories]
contents
(array): Every item inside this directory, as a JSON object with all its attributes - [Only on symlinks]
target
(string): Path that the symlink points to
- Python 3
Notice: The script has only been tested on Linux.