Reputation: 55
I have a folder with 1716 .txt files of one line each (~6300 characters per line) if I merge all the files in one and create a .txt file with 1716 lines, that file will have bigger, smaller or the same size?
Upvotes: 0
Views: 558
Reputation: 34
Depends on how you want to look at it. If you only want to know about the characters stored, then it is the same amount of characters in the one file as in the 1716 individual files, so "same size" in that sense. In terms of disk allocation, most operating systems support a fixed disk block or cluster size, making the minimum amount of disk space a file can take up equal to that disk block / cluster size. As a result, the disk space one file with 1716 lines would take up could be either smaller or equal to the 1716 individual .txt files. If you have many files that are potentially wasting a cluster by not fully populating it, the problem is mitigated with one file containing all of the characters, but likely only wasting one cluster.
This information is based on some quick searches about filesystems I had to make to refresh my memory, and from an Operating Systems course I took recently.
Inode structure: https://en.wikipedia.org/wiki/Inode Data cluster: https://en.wikipedia.org/wiki/Data_cluster ECE344- Operating Systems (University of Toronto)
Upvotes: 1