1

I am trying to split a large flat file into multiple files using SystemCommandTasklet in Spring Batch. I am retrieving the large file from scality and storing it in the temp directory.

I'm getting the below error: Cannot run program "split" (in directory "C:\Users\myuser\AppData\Local\Temp"): CreateProcess error=2, The system cannot find the file specified

This is a duplicate of the question Using SystemCommandTasklet to split file. But I'm still unable to implement this.

Split works fine in Unix/Linux.

I'm using a windows machine, so does split using SystemCommandTasklet work in windows machine?

  • It looks like you have some good debug statements in that code, can you please provide the output for all of it? – Michael Minella Aug 11 '20 at 14:20
  • Hi @MichaelMinella, Split works in PCF as it is Unix/Linux OS. Below are the logs of PCF. I've split a file with 250 rows into three files with 100 and 50 rows. split -a 5 -l 100 /tmp/ERR_File.pgp /tmp/out/ Container became healthy /tmp/out/aaaaa 100 /tmp/out/aaaab 100 /tmp/out/aaaac 50 Job: [SimpleJob: [name=Job]] completed with the following parameters: [{}] and the following status: [COMPLETED] in 1s217ms – nischalmadhava Aug 11 '20 at 15:12
  • The same code is not working in my windows machine. – nischalmadhava Aug 11 '20 at 15:15

1 Answers1

1

This is not a Spring Batch issue. It is because the split command is not available on windows. That's why it works on unix/linux but not on MS windows.

You need to find an equivalent command on windows and pass it to your SystemCommandTasklet. Otherwise you have to write some portable code to split a file (in Java for instance) that would work on all platforms.

Mahmoud Ben Hassine
  • 28,519
  • 3
  • 32
  • 50