4 Replies Latest reply on Jan 30, 2017 7:05 AM by alqemist

    rename a file on either mac or pc folder


      Dear FM PPL,


      Could any person tell me how I can go about renaming a file in a particular directory on MAC or PC.


      Currently, I have the $filepath stored as a variable as well as $filename


      But I am unawares of any particular filemaker script that can rename a file and then do a send event I believe. As a note; there is no fm server and the solution willbe a runtime.


      Any help or pointers would be much appreciaated and thank you in advance.




        • 1. Re: rename a file on either mac or pc folder

          If you can use a container for the file (either as a reference or not), then use a script that "export field contents" - using a variable to give it a new name/path it will make a copy in the destiantion directory.


          Not sure if it works on all files but I have acheived this with pdf and jpg without any problems.

          PS: Keep in mind cross platform pathnames.

          • 2. Re: rename a file on either mac or pc folder

            I find that plugins are the easiest way to do this. Scriptmaster (www.360works.com) or Monkey Bread Software’s (www.monkeybreadsoftware.de/filemaker/index.shtml) both come to mind. Depending on you platform environment you can also do it with applescript, shell script.

            • 3. Re: rename a file on either mac or pc folder

              I second pminich, Scriptmaster or Applescript are a great tool for that.


              There is another way though, you might want to try this:


              1. insert the file you want to rename into a container field in filemaker. Store in FM, not only a reference. Use the Insert File  script step.


              2. Delete the original file by using the Export Field Content [yourfile] scriptstep. If you specify the file you want to delete as output file and DO NOT specifiy a target field FM deletes the file on your hard drive.


              3. Export the file from your container with a new filename.


              For the user it will be just like renaming a file.


              Hope this is clear and works for you!



              1 of 1 people found this helpful
              • 4. Re: rename a file on either mac or pc folder

                This is by far the easiest method to implement cross-platform !!

                Thanks Vavo !