Skip to content

Instantly share code, notes, and snippets.

@phcostabh
Last active January 13, 2017 16:32
Show Gist options
  • Select an option

  • Save phcostabh/654bc3f3ecf244938b9d1eae64fbc0e3 to your computer and use it in GitHub Desktop.

Select an option

Save phcostabh/654bc3f3ecf244938b9d1eae64fbc0e3 to your computer and use it in GitHub Desktop.
N=29; for f in *.mp4; do printf -v prefix_str '%02d' "$((N--))"; mv "$f" "$prefix_str-${f%-*.mp4}"; done
N=9; for f in $(find -type f -name '*.mp4' -exec stat --printf='%W %n\n' {} \; | sort -r | awk '{ print $2 }' | sed 's,\./,,'); do printf -v prefix_str '%02d' "$((N--))"; mv "$f" "$prefix_str-${f%-*.mp4}"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment