Is there a way to split an external file using Mathematica? (Other than importing it, dividing it internally and exporting the parts)
For instance like some File Split utility do.
|
Is there a way to split an external file using Mathematica? (Other than importing it, dividing it internally and exporting the parts) For instance like some File Split utility do. |
||||
|
Sure, but Mathematica is probably the wrong tool for the job. I'll assume that by "Other than importing it, dividing it internally and exporting the parts" you mean importing the entire file, as of course something must be imported and exported. For example, to split the first 100,000 bytes to one file and the next to another you could write:
Don't forget to
It will be faster if you work with chunks rather than single bytes, for example, writing 500,000 bytes in chunks of 100,000:
If your files are not binary you could use the standard types of |
|||||
|
|
From your other "question" about the same topic which was closed it becomes clear that you expect Mathematica here to do something at a very low level which it simply doesn't provide (manipulate file-system entries without moving data). I think it's also not something that anyone would expect from a high level and multi-platform tool that Mathematica is. While you might be correct that this operation could in principle be done on the filesystem level almost immediatly with almost no actual moving of data that would mean to implement something that would not only depend on the platform but also on what the filesystem in use does offer. I'm not an expert in file system implementations but suspect that some of them could well be more complicated than your simplified abstraction implies and the whole procedure isn't even possible in many cases. If such functionality does exist at all it certainly would mean to make use of file system specific programs or APIs and that's what you should search for. If you find something for the OS/filesystem you're using, then use |
|||||
|
Runto run another program from inside Mathematica. – b.gatessucks Jan 26 at 9:14