I'm looking for some help putting together a headless NAS from an old pc and am looking for some suggestions

Really what I would like to implement is a cron job to do a md5 for each file and save the file name and location to a database so that when new files are received by the NAS it runs a md5 and checks against the database to avoid backing up dupe files. I am thinking this can be done with a storage folder an incoming folder and cron/md5. Has anyone done something similar or have a much simpler solution?