Can't get filerename statement to work

I’m still trying to create and relocate a batch of .csv files. The creation side seems OK but I get this response:

Screen Shot 2021-12-20 at 2.27.29 pm
when this statement is executed:

filerename CSVSourcePath + CSVFileName, InboundPath + CSVFileName

This is the environment:

Screen Shot 2021-12-20 at 2.32.01 pm

The global variable paths have been defined and used without failure in prior parts of the procedure but here they are, just in case:

InboundPath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/ Import testing/CSV files for import/"
CSVSourcePath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/Master folder/CSV source files/"

Clearly, both items mentioned in the error message do exist, so what’s happening?

This path includes a folder named " Import testing" (with a space at the beginning.) It doesn’t look like that folder name actually begins with a space.

I am moving the next four posts to this topic, because they are related to this one, rather than the one where you posted.

I’ve posted as a follow-up to this thread rather than create a new one because I suspect they’re related.

The databaseexportcsv statement works fine if I stay in my own paddock (ie, no path data preceding the file name) but if I put any sort of path into the parameter it fails with an error message like this:

Screen Shot 2021-12-20 at 1.50.36 pm

Is this a bug or am I missing something?

It’s working for me. Could you give us an example of a path that fails in this way?

This is the relevant code. All variables have been declared.

;  Assign values to the five folder path variables and ensure that the paths are terminated by a slash character

InboundPath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/ Import testing/CSV files for import"
OutboundPath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/ Import testing/Converted CSV files"
CSVSourcePath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/Master folder/CSV source files"
CoreFilePath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/Master folder/Core files"
ImportTestingPath = "/Users/michaelkellock/Sundry docs/Panorama stuff/Pierre's system/Import & distribution model/Import testing"

InboundPath = InboundPath + ?(InboundPath endswith "/","","/")
OutboundPath = OutboundPath + ?(OutboundPath endswith "/","","/")
CSVSourcePath = CSVSourcePath + ?(CSVSourcePath endswith "/","","/")
CoreFilePath = CoreFilePath + ?(CoreFilePath endswith "/","","/")
ImportTestingPath = ImportTestingPath + ?(ImportTestingPath endswith "/","","/")

ImportFilesArray = "+TickerStats,+TickerProfiles,+AccountStats"

;  Create the csv files and place them in the appropriate folder

looparray ImportFilesArray, ",", FileName
    openfile CSVSourcePath + FileName
    CSVFileName =  "-" + lower(FileName[2,-1][1,1]) + FileName[3,-1]+ ".csv"
    databaseexportcsv InboundPath + CSVFileName 
    closefile
endloop

It looks like the same problem as the other topic. You have a space in the path that doesn’t belong there.

Spot on Dave. I looked for an error in the path but didn’t see it because of the width setting on my procedure:

You can see that the space is the trailing character in the first line and therefore not at all apparent. But, if I was in doubt, it would have been better to re-create the folder paths.

Thank you.

Tip: To get a file or folder path into your code, drag the file or folder from the Finder straight into your procedure window. The exact path will be dropped into your code.

Nice tip! (But I have to type more, so: really nice tip!)

But be aware that the dragged path doesn’t include a trailing slash so, if you want to use it with a file name (which I guess is mostly), you need to add the slash character which is easy to forget. I always put something like this after a dragged path:

InboundPath = InboundPath + ?(InboundPath endswith "/","","/")