This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Find answers, ask questions, and share expertise about Alteryx Designer.
General Discussions has some can't miss conversations going on right now! From conversations about automation to sharing your favorite Alteryx memes, there's something for everyone. Make it part of your community routine!
To run batch scripts (such as the copy command), I use a set of macros that look like this:
Using a Control Parameter allows me to swap out arguments to my batch script (such as OldFilePath and NewFilePath in this example).
Then the batch script is as simple as this:
@Echo OFF Setlocal EnableDelayedExpansion cls SET OldFile=%1 SET NewFile=%2
copy !OldFile! !NewFile!
A few notes:
The "Setlocal EnableDelayedExpansion" is necessary (if I remember correctly) to handle file paths with spaces.
The dummy output is necessary to properly block downstream data streams if you are using this with a Block Until Done tool (see here for an exhaustive exploration of this issue)
You would need to modify this script to copy a whole directory, but the basic mechanism to achieve this is the same. You just want to tweak the script above using different commands as outlined here
If you are copying network paths (which I am assuming you are if you are deploying to server), make sure that all of your paths are UNC based. We've run into issues with using drive letters when going between local machines and executing on server.
That "movefiles.bat" would be run as an event after run without errors and it would move all of the .xls* files.
This being said, there is some level of risk when users start using command line actions on your server.
To move one or more files: MOVE [/Y | /-Y] [drive:][path]file name1[,...] destination
Specifies the location and name of the file or files you want to move.
Specifies the new location of the file. Destination can consist of a drive letter and colon, a directory name, or a combination. If you are moving only one file, you can also include a file name if you want to rename the file when you move it.
Specifies the directory you want to rename.
Specifies the new name of the directory.
Suppresses prompting to confirm you want to overwrite an existing destination file.
Alteryx ACE & Top Community Contributor
Chaos reigns within. Repent, reflect and reboot. Order shall return.