How to split the big text file into multiple files? Anyone has the sample for reference?



I have a big text file, and I want to split it into multiple text files. And the each file is less than 1.5m file size. Anyone has the solution to help me?



This may not be the solution you’re looking for and is not UiPath native but sometimes I find it easier to reach outside UiPath and use a tool that is a) open source and b) can be run from the command line. You can then invoke from UiPath passing it the parameters as needed.

In this case, I might look to something like



for Text files under 2 GB try this.

  1. read the bigFile in a string variable in_file_record
  2. total_length:=get the length of in_file_record which is no of characters .
  3. Split_size:=1500000 (which is 1.5M)
  4. Split_count:= ceil(total_length/split_size) ( if the file is 10 MB you will get 7 splits with ceil)
  5. initialize countr=1
  6. While countr <split_count
    start_location= countr*1500000
    end_location=start_location+1500000 ( you have to work on the boundary condition)
    write text file Name : (“file” +countr+".txt") Record :=mid( in_file_record,start_location,end_location)


I don’t have access to uipath studio right now. I will write the code and upload the xaml when I get a chance.
You have to test boundary conditions.


thank you, and waiting for your source code