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.
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!
Does anyone have a workflow solution for copying the contents of one folder into another folder with a Run Command or Event on the Alteryx Server?
This post by @DanM helped me figure out to use the Run command in my applications:
I use the DEL command to delete files after I am done processing them as in @DanM's solution. I think you could use the same logic to do a MOVE command.
This link might help with the syntax:
https://www.computerhope.com/movehlp.htm
@ddiesel Thank you for the reply! That post is definitely helpful in understanding some functions for Batch Files, but in this case doesn't quite give me the insights to copying that I am looking for.
You're welcome @stockcc1. I'm a relatively new user so others may be able to chime in.
Can you post more details about your use case?
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:
Hope this helps.
K.I.S.S.
The batch (.bat) file would look like this:
MOVE /Y \\NetworkDriveName\DirectoryPath\*.xls* \\NetworkDriveName\DirectoryPath\Archive
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
[drive:][path]file name1 | Specifies the location and name of the file or files you want to move. |
destination | 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. |
[drive:][path]dirname1 | Specifies the directory you want to rename. |
dirname2 | Specifies the new name of the directory. |
/Y | Suppresses prompting to confirm you want to overwrite an existing destination file. |