Filesave name trouble

I’m having trouble saving a text file with a time stamp in the file name.

local textFileName

textFileName="SQUARE "+superdatepattern(supernow(),“Month ddnth, yyyy at “,“hh:mm am/pm”)+”.txt”

filesave “/Users/jeffdean/Documents/Sculpture/Business - Finances/Gallery Sales/Exports For Wave/”+textFileName,exportForWave

I get the error in the procedure window "Filesave error: the file “21 pm.txt” doesn’t exist.

If I run the procedure with “test.txt” as the file name, it works.

What is it not liking?

Thanks,
Jeff

Don’t know if the post messed up the smart quotes but that could be where the problem is. Replace all the smart quotes with standard quotes and see if that helps:

"SQUARE "+superdatepattern(supernow(),"Month ddnth, yyyy at ","hh:mm am/pm")+".txt"

It appears that filesave automatically replaces colons with slashes. These two procedures both worked to save a file

filesave info("desktopfolder")+"testing.txt","Hello World"

and

filesave replace(info("desktopfolder")+"testing.txt","/",":"),"Hello World"

The colon in your time is being converted to a slash, and that causes it to be mistaken for a folder separator in the path.

This looks like a bug to me. It’s not going to convert a valid HFS path to a valid UNIX path because an HFS path begins with the volume name, and a UNIX path does not.

Thanks, Gary and Dave

I replaced the colon with a period, which works for my purposes.

Jeff

The Finder doesn’t allow colons or slashes in file names, so neither does Panorama.

The Finder does allow slashes, and in a UNIX context, they appear as colons.

In the Finder the file name appears as 1/20 PM. ls in Terminal shows it as 1:20 PM. When I dragged its icon into a Panorama procedure window, its name in the path that was written was 1:20 PM. However, fileload( can’t load a file with that name.