How was it referenced? What kind of file?
A file can be referenced via a container field, and external data source reference (filemaker Files only), Open URL and Send Event script steps.
I have a table to organize my files (attachments).
The attached file is stored as a reference in a contanier field named ::Attached_File
File name (file_name.pdf) is stored in a field named :: Attachement_Name
Path (D:/Work/Country/Site/Project/file_name.pdf) to this file is stored in a Field named ::Link_to_file.
I have more than 1000 attachments.
I reorganised my D: Drive (windows explorer) and now the links are broken and the attachements could not be found.
I need to now how I could look for the file Attached_File in windows explorer and get the path to repair the broken link. My problem is how I could perform this task with a script including windows command "Search" may be by Send DDE?
Thanks in advance and kind regards
I don't know for sure of a way to use windows search to find files as an automated process in FileMaker. If you can run windows search from a command line, you could set up a batch file and use send event to run the batch file. The trick is to use a calculation field or set field in a script to construct all the steps of the batch file (should be the same lines each time except for the file name), use export field contents to produce the text file and then use send event to execute it. That kicks of a windows search, but does not enable you to capture the resulting file path so that you can use it to update the reference in your container and file path fields. (You don't actually need a separate text field for the file path, a calculation can extract the file path from "by reference" container fields.)
If you can determine the new file path, you can update a by reference container field just as though it is a text field to give it an updated file reference that contains the new file path. If, when moving the files, you kept the same paths relative to the location of your database file, you may be able to use Replace Field Contents with the calculation option to update all your container fields by updating the drive letter:/enclosing folders/ portion of the file path for each file. But only if the location of all such files were changed as a group.
To better understand what file references are located in a container field and how they are formatted, define a calculation field that returns text, put the name of your container field as the sole term in the calcultion, then locate the field next to your container field.
Thanks very much Phil, I will try at first to write a batch file to perform an automatic search in windows. Second steps will be to send file name to windows for an automatic search. The result should be directed to a file. I will then extract from this file the path and include it in my database. I assume the difficulty will be to write the batch file, as I never did it. May be somebody from the forum could help or give a hint. Kind regards M.Meharzi
Hi Phil, I used following procedure: Get the list of all files from Windows explorer with (cmd and dir /s /b >File_list.xls) Integrate File_list.xls in a new database table Script to repair broken links: Search for attached file name in the new table and getting the new path from the new table. Replace old link by new one by calculation and adding “filewin:/” to the new path. All attachments have now the right link.