Skip to content

Instantly share code, notes, and snippets.

@stevehenderson
Created April 16, 2024 04:41
Show Gist options
  • Save stevehenderson/86080b266773d44c6dc088f4044fd230 to your computer and use it in GitHub Desktop.
Save stevehenderson/86080b266773d44c6dc088f4044fd230 to your computer and use it in GitHub Desktop.
Index a folder and store it in SQLite
find ~/Downloads -type f -exec stat -c "%n|%s|%y" {} \; | awk -F"|" '{printf("INSERT INTO files (file_path, file_size, file_date) VALUES ('\''%s'\'', %s, '\''%s'\'');\n", $1, $2, $3)}' | sqlite3 mydb.db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment