LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help needed to split files (https://www.linuxquestions.org/questions/linux-newbie-8/help-needed-to-split-files-310624/)

242VDM242 04-07-2005 01:54 AM

Help needed to split files
 
In order to backup large data archives I was wondering if there is a command that allows to split a big file into several smaller chunks of specified sizes.
for example to backup

slackie1000 04-07-2005 01:57 AM

hi there,

Code:

man split
to define size per file, you should use the parameter "-b"

regards

slackie1000

242VDM242 04-07-2005 02:02 AM

... continued (sorry my fingers are too big for this keyboard...)

For example to backup a big archive .tar.gz (> 10Go) into several chunks that could be burned on DVDs ?


The other solution for me would be to specify the chunks sizes before creating the archive, I have a folder containing several thousands of files that I compress using a "tar -czvf command". Can I at this time specify that I want several archive files of given sizes ?

Thanks for your help

slackie1000 04-07-2005 02:35 AM

hi there,

you can use split to divide the big file according to your wish
Code:

split -b $DVD_SIZE $YOUR_FILE
should work.

regards

slackie1000

242VDM242 04-07-2005 03:01 AM

Hi,
Thanks it works !

Split filename -b filesize

A naive question : several files are created, now no problem to backup them but the day I want to unsplit those files how do I proceed ? Shall I simply double click on the first one ?

slackie1000 04-07-2005 03:04 AM

hi there,

welcome, mate!
you can use
Code:

cat
and merge back all of them.

glad to help!

regards

slackie1000

242VDM242 04-07-2005 04:01 AM

I made a test on a small file (40Mo) that I splitted into 2 files. When in the directory of these 2 files I use simply the command "cat" nothing happen. When I do :

cat file1 file2

no 'final' file is created, the concatenation scroll on the screen

...

slackie1000 04-07-2005 04:06 AM

hi there,

so you do
Code:

cat file1 file2 > output.file
and it is done.

with a lot of files, should be better a shell script.

regards

slackie1000

242VDM242 04-07-2005 04:19 AM

Many thanks for your precious help, I finally can do what I want ...

Regards,

harken 04-07-2005 08:37 AM

You could try DAR (see my sig) which allows you to perform a compressed backup (using gzip or bzip2 algorithms) splitted in several files with sizes of your choice. It also has many other handy features, even a backup manager.

mcosta 04-07-2005 09:39 AM

I told you in the other related thread. To get good and quick answers, you must make good questions. I am not blaming you, just telling we have not learned to read minds. You should explain the problem and what you want precisely.

Now you know you can split files with the 'split' command. Just read 'man split' to know how to use it. Then you save your and our time.

To join all:
1 - Enter 1st dvd
2 - Copy the file, ie: /my_big_file.tar.gz
3 - Enter next dvd
4 - cat /media/dvd/my_big_file.* >> /my_big_file.tar.gz
5 - goto 3

The >> appends to the end of the file. > overwrites.


All times are GMT -5. The time now is 12:50 PM.