from Hacker News

Ask HN: Tool for Mac, create database from filesystem

by beamatronic on 4/6/22, 7:15 PM with 3 comments

I need a tool that can recursively scan a folder on a Mac and create a relational database (could be SQLite, postgres, mysql, etc) containing the file attributes for all the files and folders found. I haven't seen any tool that does exactly this and was curious if the HN crowd knew of one.
  • by colburnmh on 4/7/22, 8:22 PM

    You could try using find(1) to display the results and use that to capture the results, and then use cut(1), sed(1), or awk(1) to convert that to a CSV that could be loaded into your database of choice:

        find . -print -ls | awk ... > /tmp/foo.txt 
    
    Not sure if that gives you what you want, but it's a relatively fast way to get to what you want, I think.
  • by slater on 4/6/22, 7:17 PM