7 Replies Latest reply on Oct 21, 2016 12:51 PM by JefferisPeterson

    Why can't I import an entire folder of Word Documents,



      Why can't I import an entire folder of Word Documents,


      In our infinite wisdom the firm I work for fired basically the entire IT department this summer including three people who were certifiable geniuses at all things FileMaker. I am not a genius, at FileMaker or anything else but having once figured out how to change the file path from Mac to PC I have been deemed a suitable successor.


      I have a folder with ~2500 word documents, each of which has to become a record in a database. I am starting from the document library template and didn't think this too daunting a task as I would import the entire folder. To my frustration FileMaker only appears capable of importing images and raw text documents. I can insert the files individuals to the container field but that seems to tedious to even contemplate repeating 2500 times.


      I have mucked around with a couple of plug-ins, but none of them seemed to do what I wanted in an obvious manner and I am completely out of my league. I don't need to import the text within the word document, just containerize it within the database. 


      Is there a way to make FileMaker import and containerize an entire folder regardless of what is in that folder?


      FileMaker Pro 10 / FileMaker Server 10, I'm working on Windows XP - but I have access to a Mac.  



        • 1. Re: Why can't I import an entire folder of Word Documents,

          I have created a FileMaker file, which runs an AppleScript (in a Perform AppleScript step) which will get all the files in a folder, write them to a text file (on your desktop), then import them into FileMaker (as new records). It can then also Insert the file of each into a container field. I set it up to Insert [x] As reference only, but you can uncheck that (in the script step) if you want to "embed" the files (which may be more convenient, but increases the file size greatly).


          A few caveats. This routine gets the file size and dates (creation and modification). It is still very fast. However, it is mostly Unix commands; it does not handle "files" which are actually folders very well. It sees them as a folder with multiple files, and imports each separately. So, older Word docs would be fine, newer docx files would not.


          I have other "vanilla" AppleScript routines which would see these as "files", as you'd expect. But they are quite slow at getting the size and dates. If you do not need the size & dates, they would be fast. Even with the size & dates, on 2500 they would likely be fast enough. So let me know if the example file is not suitable.


          Link to FMforums post with example file (shortened): http://fmp.fm/49

          • 2. Re: Why can't I import an entire folder of Word Documents,

            Thanks Fenton!


            Fortunately the entire folder is only about 35MB so embedding isn't too burdensome, however the script appears to be choking on some System 7 vintage files with unconventional nonsense filenames with colons and excessive periods. 


            When it comes across one of those files I have to select it manually, but that is much, much easier than doing every single one manually. 


            Thankfully we never upgraded past Office XP or Office 2004 so the much maligned .docx files aren't an issue.  



            • 3. Re: Why can't I import an entire folder of Word Documents,

              Good, I'm glad it at least mostly worked. I wonder which part of it is choking on the add file names. It may be the Insert step itself, in FileMaker. Since it uses a colon to separate its "filemac:" from the rest of that path, and uses the period to identify the extension (hence type of file), it may get confused if there are extra ones in the name. 


              One solution, since it is doing this within a loop, therefore is only doing one file at a time, would be to use AppleScript to look at the file name, and fix it if needed, before trying to insert it. This may slow it down a bit, but not terribly, as it would only have to actually fix it every once in a while.


              AppleScript has somewhat unusual tools for find/replace; basically you switch the internal separators to something, get the resulting text, then switch them back. It is a powerful, fast and flexible method, but a little verbose and odd the first time you see it (or think about it).


              There are also several "batch file rename" shareware and freeware applications on VersionTracker, at least for Mac (likely for PC also). 


              System 7. Wow, that's some old files. Mac Office 2008 is pretty good I guess (I only use Excel). But those sitx (xslx) files (compressed folders really, several folders, lots of xml files) are just way too much for older tools to deal with. Other AppleScript tools deal with them fine, but, as I said, they are slow to get the size and dates.

              • 4. Re: Why can't I import an entire folder of Word Documents,

                I am just searching the folder with Spotlight for the dodgy characters and correcting them manually, the real fun was when the first Windows PC's arrived and some poor soul had to manually add .doc to the end of all these old files. 


                We were founded in 1991 so System 7 and FileMaker 2.0 documents are in abundance. Connect to our server and you will see databases with all sorts of live web connections, retrieving dynamically created files with interfaces that are a thing of beauty - and you will see databases that look like they should be running on a Macintosh SE because that is what they were created on. 


                Once again, thanks for your help! 

                • 5. Re: Why can't I import an entire folder of Word Documents,

                  Hi there, I know this thread is a bit old, but I figured I'd throw my question out there anyway...

                  I'm using FMP to manage my library of PDFs. I do want to insert the files into each record, and so I clicked OK when it asked me if I wanted to do that. But then, for each file, it can't find the file itself, and I have to locate it. I'd rather not do this for every file-- any help? Thanks in advance!!

                  • 6. Re: Why can't I import an entire folder of Word Documents,

                    @Stearns - unless you have a really good reason to insert the documents, I wouldn't.  Check your file size after inserting even a few 10s of docs of even a small size, and the FM file size will have exploded.  Also, if you insert by reference the original file will open by a doubleclick on the container.  By the way, if you are only ever using pdfs you can set a webviewer in the FM file to display the document directly, with all the usual PDF Reader tools, just as if you were viewing a pdf with your web browser.

                    With 'Reference' you will have to have a storage location available as the same path name for all users, of course.

                    Without using the 'By Reference' option I think you can view the document by choosing 'Export Field Contents...' and automatically opening the file.

                    • 7. Re: Why can't I import an entire folder of Word Documents,

                      Hi, the short link has failed. Do you still have that script somewhere and does it work in the latest Mac OS?