I read several files and merged them into one file, now I want to delete a specific file from it.
Let's say that there are 10 files with 1GB of size each, I merged them into one file making it 10GB of size, now I want to delete the 7th numbered file from it, is it possible? how do I achieve it?
copy file1.txt + file2.txt + ... + file10.txt newfile.txt
here we skips the 7th file i.e. file7.txt
. This is same as your 1st approach. It should be the efficient way as copy command interacts directly with kernel and memory device. Use may like to refer Robocopy
too. You may pass construct the command from .Net and use shell execute.BinaryWriter
to copy and overwrite using Seek
method. SeekOrigin.Current will help you to overwrite the chunks.