last day (15 days later) » 

19:46
0
Q: How to merge files in Linux while deleting the source files

Avery AlejandroI have 2 large files (of about 27 GB each), which I need to merge. They were originally one whole ZIP file, but I split it. The problem with the cat command is that it creates a new file which has the source files' content, which I do not want to do (since I don't have that much disk space left)....

How did you split it? Would just concatenating the two files yield a valid Zip archive?
@Kusalananda I think so. I used the split command, by following this guide: howtoforge.com/tutorial/…
Do you have space under /tmp or elsewhere (/var?) that you could use temporarily?
@Kusalananda Yes I do have a /tmp directory, and I also have an 8 GB flash drive
How much free space in /tmp? (df -h /tmp)
19:46
@Kusalananda I don't have a separate /tmp partition, just a /tmp directory. I have 28.3 GB left.
And in the current directory where the archive bits live? (df -h .)
Hi
28.3 GB. It's one partition
Ah, so /tmp and your current directory lives on the same partition.
Does any other place on your system have 28+ GB free?
19:48
Nope, only my flash drive has 8 GB free. Do network folders count?
Do you have backups of the archive?
(just for safety)
Yeah. My desktop has the original archive (61 GB), and I needed to move it to my laptop. It would take way too long to transfer it over the network, so I decided to split it and use my 8 GB flash drive. It literally took all day. I shouldn't have done that... Too late to say that now, heh
I think, and don't do this now, but cat part2 >>part1 would add the second part of the archive to the end of the first part.
Assuming the files are called part1 and part2.
You have enough space to do that.
Oh, I didn't think of that
Well I did think of that, but I guess I was overthinking
But I can't really guarantee that it would work and that you would not loose data.
19:51
It's fine, I can just transfer the file over the network. Last resort
This relies on the fact that you have 28 GB free.
27.8 GB free
part2 is 27.3 GB
I think I'll be fine
you have to have enough space to hold both the complete archive and part2
yes
Only issue....
A filesystem usually tries to hold a certain percentage of space free.
So you may run out of space anyway.
Unless you do it as root.
Aghh I'll just delete some anime
Should save a few gigabytes
:-)
I'll summarise this in an answer. Write a comment on it when you know how it went.
19:55
Okay

last day (15 days later) »