I’m new to Data Services and need some help in creating a script that will sit at the end of a workflow which will move an excel file (.xls) from one folder location to an archive folder. The file move needs to complete so that when the workflow is executed the following day, the dataflow before the script picks up the new file (hence the wildcard * in the file name)
exec(‘cmd’,‘Move \FAS2050N1\Groups\Reports\Business Intelligence\Excel Based Feeds\AACC\Warehouse Feed\Daily CDN Export*.xls \FAS2050N1\Groups\Reports\Business Intelligence\Excel Based Feeds\AACC\Warehouse Feed\Archive’)
When I validate the script I get the following error
[Script:SC_DAY_MOVEFILE]
(Ln 1) : Syntax error : found <[end of text]> expecting <SET, SUBVARIABLE>
Since you have a space in the file path, it MUST be double quoted and the backslash is an escape character so you must at least double up the first backslash in both your source and target paths.
When working at the command line, the interpreter treats each space as a delimiter between arguments. You quote it to tell it that the space is included in that particular argument.
In case not, your statement should look like this:
exec(‘cmd’,‘Move “\\FAS2050N1\Groups\Reports\Business Intelligence\Excel Based Feeds\AACC\Warehouse Feed\Daily CDN Export*.xls” “\\FAS2050N1\Groups\Reports\Business Intelligence\Excel Based Feeds\AACC\Warehouse Feed\Archive\”’)
I believe this will work. You’ve basically got two things going on: 1) Even if you types this at the CMD prompt directly, in order to use folder names with spaces, you’d have to put the whole path in quotes; and 2) within the script in DS, you need to escape the backslashes, and to do so you backslash them.
Also, depending on the version of DS you’re using, you might have access to the function ‘file_move’ (it’s in the Miscellaneous function list). Might be worth a try.