Rename container files

Rename container files

02/12/2014 | Jan Stieperaere

What?

Rename your container files without exporting/importing. Fully native FM13. Works in WebDirect, Server, Go, …

How It Works?

This technique makes use of FM13’s new Base64Encode() & Base64Decode() functions. When decoding a base64 string, filemaker gives you an optional parameter to specify a filename. This is the key to rename your container file.

The total function looks like this:

Base64Decode ( Base64Encode ( Table::Container ) ; “NewFileName” )

The example file ( see link at the end of article ) works with a script who renames the file and replaces the original container file. But you could also apply it as an auto-enter option to unify all your container object filenames…

Why use it?

Not only because it is clever and you can impress your teammates. It is the only solution that works in WebDirect!

Drawbacks?

For large container files, it takes a long time to encode/decode the file. Tested on Mac with SSD drive: container 100MB: 30sec. But you could use ‘Perform script on server’ to offload it to the server machine…

Update: 4/12/2014
Be aware that it doesn’t work with compressed containers!
Why?  Read the issue report from Vincent.

Update: 16/12/2014
Douglas Wallis, Responsable Technique – Southern Europe FileMaker, explaines why & how to workaround the issue with compressed containers:
“The reason there is a difference between the MD5 values from the uncompressed and compressed containers is that the files are actually different. In the example from Vincent, the name of the uncompressed file is « Apple.txt » whereas the compressed file is « Apple.txt.gz ».
So when you rename a compressed, you should actually get your script to rename the file from Apple.txt.gz to NewName.txt.gz . That way, you keep the same file format and at least the file can be exported from FM and used.”

Click here to download the example file.

clickworks_admin