@foxmask is exactly correct
To do what you want you will need to write a script that reads in a file, searches for file links and then uses the joplin api to programmically convert the file resource to a resource ID.
You can see @foxmask 's excellent jong toolkit for examples on how to use the api.