![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: May 2005
Location: ma
Posts: 130
Rep Power: 4
![]() |
how to recursively copy or move part of a directory limited by size?
hi im trying to back up my system to do a fresh install. I have a directory named music where i ripped some of my cds. It is 2.2 gigs so i have to break it up to burn to cds as data files. I was wondering if there was any command i could use in a shell script that would be able to go thru that directory and splitting it up into directorys that are 600-700 mb to fit on a cd. The directory is set up like this ~/music/artist/album/files. I'd like the structure of the resulting components to be like the music folder - so i wouldn't want all the mp3s to be just tossed into 3 seperate folders. Any replies are appreciated. thanks in advance.
|
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 314
Rep Power: 4
![]() |
I suggest:
tar -c music | gzip -9 > backup.tgz That'll give you a nice compressed tarball for starters. MP3s don't squash down that much, though, but this does mean your hierarchy is nicely preserved for starters. Splitting this file into 700Mb (say) chunks is no problem; see the manpage for the split(1) command. Burn the chunks onto disks, then to restore your backup, copy the chunks back; cat chunk2 >> chunk1 cat chunk3 >> chunk1 ... mv chunk1 backup.tgz gunzip < backup.tgz | tar -xvf - You can just cat them together because Unix won't mangle the contents when you do that. When you unpack the resulting tarball, your directory structure should be preserved. Hope this helps! |
|
|
|
|
|
#3 | |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: MA, US
Posts: 204
Rep Power: 4
![]() |
Quote:
gzip: tar czvf backup.tgz music/ bzip: tar cjvf backup.tgz music/
__________________
"A stupid man's report of what a clever man says can never be accurate, because he unconciously translates what he hears into something he can understand." - B. Russell http://web.bryant.edu/~srk2 |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|