我尝试使用以下命令拆分文件Mac:
split -b 20mb myFile.zip
然后我得到一些以x开头的文件: xaa xab
使用cat
terminal命令在Mac上恢复文件没有问题:
cat xaa xab > myFile.zip
但它无法在Windows上执行cat
命令... :-(
任何可行的解决方案?
先谢谢
Ishai
答案 0 :(得分:2)
以下批处理脚本将执行您所需的操作。在batchfile.bat x myFile.zip
之前使用它,它循环遍历以指定前缀x
开头的所有文件,并使用myFile.zip
将它们附加到结果文件type
:
@echo off
set INVARGS=0
if [%1] == [] set INVARGS=1
if [%2] == [] set INVARGS=1
if %INVARGS% == 1 (
echo Usage: %0 ^<file_prefix^> ^<result_file^>
goto eof
)
set "prefix=%~1"
set "resFile=%~2"
rem create new empty file in directory of batch file: %~dp0
break>"%resFile%"
rem loop through all output line of the dir command, unset delimns
rem so that space will not separate
for /F "delims=" %%a in ('dir "%prefix%*" /b /s /a-d') do (
rem don't use the result file
if not [%%a] == [%resFile%] (
rem append the output to file
type "%%a">>"%resFile%"
)
)
:eof