Copy File

Hello everyone,

I would like to know if its possible in a Copy File Activity to make the new file DisplayName to be a concatenation of a name and a variable, that I can increase in a assign overtime to have like a version system.
First time I save will be:

  • Filename v1;
    Second time:
  • Filename v2;
    And so on…

If this can’t be done with copy file is there any other way I can achieve this?

Thx in advance
Best Regards

@tpernes

Hi, Sorry for this but i am not sure what you are trying to automate. But in case your intention is to create new files with different version number as told in your example.
Please try using Create File and assign the value for (Name) parameter as “Filename”+variable

My itention is to copy my file of data, example the file - DataFile , before I do anything to it. So I have a insurance file if I screw up in some analysis. I want to save it like DataFile v1, DataFile v2, and so on. Each time I save I want to increment the version.

Thx in advance

@tpernes
I think you should do as followings:

1)provide a variable of bool type, default value is true
2) using while activity, check true, execute check file of the format file+index as name exists or not.
3) have if activity, when check file+index is true, place assgin activity with index increment by 1
4) build a datatable
5) when drop out of while statement, save datatable to excel with the latest file+index as name

TKS

:smiley:Create File and assign the value for (Name) parameter as “Filename”+variable

You can provide the path in the destination as Filename + version Number and increment the version number in the destination using assign activity every time you are copying the file.

I hope this resolves your problem.

i have solved a very similar problem with somehting like this:

tempPath = path+FileName
count= 0
While(File.Exists(tempPath))
{
tempPath=path+Filename+count
count = count+1
}

Whit that code you will get an incremntal filename version each time you use it.

Make a workflow named VersionFile.xaml use Path and file name as inputs and you can re-use it everywhere

I wish it helps. And remember to mark as solution if its working.

hi,

Watch the tutorial,

thanks,
Karthik