Skip to content

Instantly share code, notes, and snippets.

@bradcordeiro
Created May 16, 2017 20:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradcordeiro/ddb755befd1206c3454815b2c46ad981 to your computer and use it in GitHub Desktop.
Save bradcordeiro/ddb755befd1206c3454815b2c46ad981 to your computer and use it in GitHub Desktop.
Print file information from LTFS index schema to CSV format using xmlstarlet
VOLUME_UUID=$(xmlstarlet sel -t -m "/ltfsindex" -v volumeuuid "${1}")
VOLUME_NAME=$(xmlstarlet sel -t -m "/ltfsindex" -v directory[1]/name "${1}")
xmlstarlet sel -t -m ".//file" \
-o "${VOLUME_UUID}" -o "," \
-o "${VOLUME_NAME}" -o "," \
-v "extentinfo/extent[1]/startblock" -o "," \
-v name -o "," \
-v "length" -o "," \
-m "ancestor-or-self::directory" -v "name" -o "/" -b -o "," \
-v readonly -o "," \
-v creationtime -o "," \
-v changetime -o "," \
-v modifytime -o "," \
-v accesstime \
-n "${1}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment