Data Services Workflow Script Help

Hi All,

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>

Any help would be greatly appreciated

Kind Regards
Wardie


Wardie (BOB member since 2012-09-26)

Noticed that it needed a flag integer to get the code to validate

exec(‘cmd.exe’,‘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’,1);

But now I get an error 50306 and the file isn’t moved[/b]


Wardie (BOB member since 2012-09-26)

If you’re going to put spaces in your folder paths, you need to put double quotes around the path when you attempt to access it via the command line.


jlynn73 :us: (BOB member since 2009-10-27)

Tried the string with double quotes around it but still didn’t move the file.


Wardie (BOB member since 2012-09-26)


Wardie (BOB member since 2012-09-26)

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.

any doubt print it out. :wink:


jlynn73 :us: (BOB member since 2009-10-27)

Did you figure this out, Wardie?

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.


ht1815 (BOB member since 2008-05-23)

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.


Nemesis :australia: (BOB member since 2004-06-09)