Robocopy with Variable

Currently we are using a File Content iterator with Robocopy to copy the files from location A to locaion B.

This works fine but it is very slow to other options with Robocopy.

Other options would be:

1. To list all the files within the Extra Command Line Option of the Robocopy Settings.

    This works well but you cannot pass in a list to be used.

2. Use a text file with one line of text with spaces instead of CRLF between each filename.

   Read this text file into a variable

   Again this works well, but the list is on one line.

3. Option - this issue is if the files are listed on seperate line, and we read into a variable there shoudl be an option to change the CRLF to spaces or Tabs between the line.  Then Robocopy can use the file but right now it fails on source due to havign the CRLF at the end of each file.

What are some other ways to pass a variable into the Robocopy Extra Command Line Options that can work withough writing to  much code?

 

Dennis,

When you use the file contents iterator, can you append the filenames to a variable with a space as delimiter instead of a crlf?

Or, you can use the “Text Find/Replace” action to replace all CRLF’s with whatever character you want. Use the a regular expression “\r\n” (without the quotes) to match CRLF and then on the Replace tab add in the replacement character you want.

hth.
.t8

Tate,

Thanks I am trying to make this work. 

With File Contents Iterator, I do not see where the append filename since this is the FIle Content

The options I see is Filename and Options but nothing to append or replace on the content!


I am currently  performing the following

Read Text File.  Storing into a variable Then on the Robocopy line in teh Before Action I am

VariableName =Replace(VariableNameVBCRLF, " ")

The difference between the two has been about 5 minutes faster for teh Text file Read!


Dennis

 

 

Hi Dennis,

I see what you mean now with the File Contents Iterator - I thought you were using it to build up a string to send to Robocopy instead of calling robocopy for each file found.

Anyway - looks like you’ve found a solution, and certainly does save a lot of time :slight_smile:

.t8

Another option to explore is add an option on the file content iterator to dump all into a variable first with replacing ending string CRLF with some other item!  Then it is more versital to be used not only to iterate files content but also used to read kind of like a read.all funtion!