Your last post read more like a "blog" entry than a request for help.
Specifying a different folder for your backup using the save a copy as script simply requires doing some "surgery" on the expression for the path variable. The precise location of the folder for backups relative to your database file will determine what changes are made to the path you can get from the path to the database file's location.
Right which is the help I'm looking for .... I just don't know if it's simpler to send you back to the original thread or re-post all the bits that tie to it. I posted a reply on the one particular thread yesterday and hadn't heard anything so I figured it was too old ... Should I collect all the important elements from the old thread and re-post?
Whichever, but what exactly is the question? I can tell you are having trouble getting it to work, but not what part of working with a file path is giving you that trouble. Can you post either here or there with a more specific description of where you are having trouble getting this to work?
With either setup this will allow me to remove the entire "database" folder from the time machine backups and I won't have to remember to individually remove any as I create new ones in the future.
Is there a way to check if the folder exists and if not create the path automatically?
Not using just FileMaker scripts. You'd need to use either a system script or a plug in to check for a missing folder and also to create that folder.
Once the folder is in place you can either specify the path to that folder as literal text or calculate it using the path to your database file as a starting point. That is a matter of setting up the needed calculation for your $Path variable with text functions--particularly using the Position function to check for the position of specific instances of the / character.
You could use:
Let ( [ F = Get ( FilePath ) ;
L = Length ( F ) ;
folderpath = Left ( F ; Position ( F ; "/" ; L ; -2 ) ) & "Backups/" ;
period = Position ( F ; "." ; L ; - 1 ) ;
slash = Position ( F ; "/" ; L ; - 1 ) ;
ex = Right ( F ; Length ( F ) - period + 1 ) ;
filename = Middle ( F ; slash + 1 ; period - slash - 1 ) & " " &
Substitute ( Get ( CurrentTimeStamp ) ; ["/" ; "-"] ; [":" ; " " ] ) & ex
folderpath & filename
) // Let
Sorry, I had originally mentioned this in the other thread and when I copied over some of the information I forgot to mention it again. What I'm hoping to do is have the backup folder sit beside the database folder to allow me to simply block time machine from touching the entire database folder. That way no matter what I create in the future I don't need to remember to go to timemachine setting to remove the newly added file.
So with that idea I would put the file in the database folder following the same format mentioned earlier and have a script that backs out to where the database folder is and saves to a folder named database-backups. This script will allow me to place the file on any machine and in any area and as long as I have a folder called database and a folder called database-backups right beside it and follow the same folder tree structure I can let it do it's thing completely on it's own without having to manually copy in a path.
Except for automatically creating the folder, what I have described in my previous post should do that. it saves the file to a folder named backups just inside the databases folder.
And if you want to specify a different location, what I posted should serve as a model for how you would set up that file path calculation.
You're correct, got it working. Sorry about that and thanks for your help!
I'm picky when it comes to file order and simple thing like not having the files be in perfect chronological order because there isn't a "0" in front of say 9 56 ( in the 24 hour clock) bugs me. So I set out to add the "0" in front of single digit hours so everything stays in perfect order but I've hit a road block. I'm stumped as to how I get the rest of the time back into play. What I've done in the following code is reformatted the time to be on a 24 hour clock with a custom code. I then pulled out the hour from the time and added a "0" in front when the hour is a single digit. I don't know how to get the minutes and seconds back in though ....Let ( [F = Get ( FilePath ) ;L = Length ( F ) ;folderpath = Left ( F ; Position ( F ; "/" ; L ; -3 ) ) & "Backups/" ;period = Position ( F ; "." ; L ; - 1 ) ;slash = Position ( F ; "/" ; L ; - 1 ) ;ex = Right ( F ; Length ( F ) - period + 1 ) ;Date = Substitute ( Get ( CurrentDate ) ; ["/" ; "-"] ) ;Time = Substitute ( TimeFormatAs ( Get ( CurrentTime ) ; 24 ) ; [":" ; " "] ) ;TimeFormat = Right ( "0" & Left ( Time ; Position ( Time ; " " ; 1 ; 1 ) - 1 ) ; 2 ) ;filename = Middle ( F ; slash + 1 ; period - slash - 1 ) & " " & Date & " " & TimeFormat & ex] ;folderpath & filename) // Let
Try something like:
Let ( [ T = Get ( CurrentTIme);
H = Right ( "0" & Hour ( T ) ; 2 );
M = Right ( "0" & Minutes ( T ) ; 2 );