LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Archive a directory without using additional disk space? (https://www.linuxquestions.org/questions/linux-general-1/archive-a-directory-without-using-additional-disk-space-4175459383/)

enkrypted 04-24-2013 12:52 AM

Archive a directory without using additional disk space?
 
I have a VPS with 10 GB disk space, and 8.5 GB is occupied by multiple files, that I want to transfer to my computer and then delete from the vps.
It takes a lot of time to download the files one at a time, and then rearranging them into the directory/subdirectory structure they originally had.
So I want to be able to make an archive of these files(all of them are within a single directory), without using any additional disk space. Like maybe simply convert the directory into an archive, or maybe archive a file then delete it, and so on.
Is that possible? compression does not matter that much to me.
Thanks in advance

evo2 04-24-2013 01:08 AM

Hi,

why do you need to archive them to get them off the vps? Have you considered using something like rsync?
Code:

rsync -auzv -e ssh myvps:/path/to/files/to/archive .
The above command would be run on the target machine, "myvps" is the hostname or ip of your vps, and the directory structure of /path/to/files/to/archive on the vps would be synced to the directory "archive" in current working directory. The -z options means the data is compressed before transfer (and decompressed at the destination) and the "-e ssh" (which is probably default anyway) means the authentication etc is all done using ssh. Once you've got what you want from the vps you can delete the originals.

Evo2.

unSpawn 04-24-2013 01:12 AM

Quote:

Originally Posted by enkrypted (Post 4937717)
So I want to be able to make an archive of these files(all of them are within a single directory), without using any additional disk space. Like maybe simply convert the directory into an archive, or maybe archive a file then delete it, and so on. Is that possible? compression does not matter that much to me.

While you can use tar w/o compression and use the --delete-files switch this does not make sense as the archive file will take up as much space as the original. Besides the smaller the archive the less D/L time it will take. So compression does matter. What you could do is try and find out which files benefit from compression the most (plain ASCII files) and see what you gain from compressing those first. One other thing that may come in handy is a tmpfs scratch disk, tho at 8G you'll still better archive large files separately to avoid it halting on lack of scratch space.


Quote:

Originally Posted by enkrypted (Post 4937717)
It takes a lot of time to download the files one at a time, and then rearranging them into the directory/subdirectory structure they originally had.

...but rsync will accomplish all of that. Just start it and fetch some $beverage ...

eklavya 04-24-2013 01:21 AM

If you want to copy the directory structure of your archive directory, not the files
Code:

rsync -av --include '*/' --exclude '*' /path/of/the/source/folder /path/of/the/destination/folder
If you want to copy the files only, not the directory structure
Code:

find /path/of/the/source/folder -type f -exec cp {} /path/of/the/destination/folder \;

enkrypted 04-24-2013 02:52 AM

I have a relatively slow internet connection at home. My maximum download speed is ~400 kbps.
Also, is rsync possible on Windows? And do I need to install it on the vps as well?
I want to convert it into an archive because that way I would be able to transfer it in one go. I like to use IDM, as that gives me the highest speed.
Also, these files are media files. Videos to be specific.
Thanks for the help. I'll try both the methods.

pan64 04-24-2013 03:59 AM

rsync is definitely usable on slow networks, available on windows too. it should not be installed at all, because it consists of 2 or 3 files altogether and you can put them anywhere you want (but of course you can install it).
rsync is able to transfer only differences.

enkrypted 04-24-2013 04:06 AM

So would I be able to get my maximum speed using rsync?

pan64 04-24-2013 04:08 AM

I have no idea about your config, but probably yes.

enkrypted 04-24-2013 04:09 AM

Ok, I'll try it soon

evo2 04-24-2013 05:09 PM

Hi,

Quote:

Originally Posted by enkrypted (Post 4937784)
I want to convert it into an archive because that way I would be able to transfer it in one go.

They don't need to be in an archive to do that. Additionally, with rsync, if the transfer is interrupted for some reason you can pick up where you left off.

Quote:

I like to use IDM, as that gives me the highest speed.
What is IDM ("apt-cache search idm" doesn't yield anything relevant).

Quote:

Also, these files are media files. Videos to be specific.
Ok, in that case you probably won't gain anything by trying to compress the transfer (ie don't use the -z option)

Cheers,

Evo2.

enkrypted 04-25-2013 04:28 AM

I want to archive the files, not necessarily compress them.Internet Download Manager(IDM) is a Windows software for boosting downloads.

pan64 04-25-2013 04:52 AM

have you tried rsync? it can really do that job.

enkrypted 04-25-2013 05:09 AM

I will try it tomorrow, when I have more files.


All times are GMT -5. The time now is 03:36 AM.