Skip to content

Instantly share code, notes, and snippets.

@adrienjoly
Created July 15, 2025 17:39
Show Gist options
  • Save adrienjoly/377c61eb7265ae774b18c6351c2277df to your computer and use it in GitHub Desktop.
Save adrienjoly/377c61eb7265ae774b18c6351c2277df to your computer and use it in GitHub Desktop.
a bash/terminal script to index the contents of a volume into a TXT file. tested on macOS.
# usage ./index-volume.sh "Photos 2017-08"
# ... will index the list of files from "/Volumes/Photos 2017-08"
# ... to ~/Desktop/volumes/Photos 2017-08.txt
set -e # stop the script if any command fails with a non-zero exit code
mkdir -p ~/Desktop/volumes
ls -R "/Volumes/$1" > ~/Desktop/volumes/"$1.txt"
cat ~/Desktop/volumes/"$1.txt"
drutil eject external
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment