英文:
Using SystemCommandTasklet to split a large file in Windows
问题
我正在尝试使用Spring Batch中的SystemCommandTasklet将一个大型平面文件拆分为多个文件。我正在从scality检索大文件并将其存储在临时目录中。
我收到以下错误消息:
无法运行程序"split"(在目录"C:\Users\myuser\AppData\Local\Temp"中):CreateProcess错误=2,系统找不到指定的文件
这是问题的重复,https://stackoverflow.com/questions/62753608/using-systemcommandtasklet-to-split-file。但我仍然无法实现它。
在Unix/Linux中,拆分正常工作。
我正在使用Windows机器,那么在Windows机器上使用SystemCommandTasklet拆分是否可行?
英文:
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 https://stackoverflow.com/questions/62753608/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?
答案1
得分: 1
这不是一个Spring Batch的问题。这是因为split命令在Windows上不可用。这就是为什么它在Unix/Linux上工作但在MS Windows上不工作的原因。
你需要在Windows上找到一个等效的命令,并将其传递给你的SystemCommandTasklet。否则,你必须编写一些可在所有平台上工作的可移植代码来分割文件(例如在Java中)。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论