[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: File archiving questions
or a quick way of doing it is by using this script(To use it put the following in a file, then type
"perl whateverfileyouputitin"):
#!/usr/bin/perl
$dir = "/home/blah/a"; # dir to move from
$dirto = "/home/blah/b"; # dir to move to
$maxmeg = 650; # in megabytes
$maxsize = $maxmeg * 1024;
@x = `ls -s $dir`;
foreach $x (@x) {
if($x =~ /\s*(\S*)\s*(\S*)\n/) {
($sz, $fn) = ($1, $2);
}
$mysize += $sz;
if($mysize < $maxsize) {
print $fn . "(" . $sz . ":" . $mysize . ")\n";
$cmd = "mv " . $dir . "/" . $fn . " " . $dirto . "/";
print $cmd . "\n";
# system($cmd);
}
}
Uncomment the system($cmd) after you've verified that it will do the correct thing for you (It will
print the filename(filesize:cumulative size) for each file it's going to move followed by the command it
would use to move it.
If you have any problems let me know :)... I realize it's a badly written script but hey it only took 2
minutes :)
--Jamon Terrell
4/14/2002 10:32:12 AM, SILUG <silug@bruneworld.tzo.com> wrote:
>Hello! Here's my situation:
>
>I have a directory, called "a", that has 15,500 files in it. The total bytes
>stored in the directory (as computed by executing command "du -sk a" ) is
>2.4GB.
>
>I wish to store these files on CD-ROM's. I want them stored as "files" on the
>CD-ROM's. (i.e., not in a .tar or .zip or whatever).
>
>So... I figure I have to:
> 1. Create a directory called "b".
> 2. Copy about 650MB from "a" to "b".
> 3. Create a .iso file by typing:
> mkisofs -o fred.iso -v -J -r b/
> 4. Burn a cd by typing:
> cdrecord -v -eject dev=0,0,0 speed=12 fred.iso
> 5. rm fred.iso
> 6. rm -f b/*
> 7. If there are still files left in "a", go to step #1.
>
>Easy, huh? My problem is in step #2, above. What's an easy way to copy
>files from "a" to "b" and have the command STOP after 650MB have been
>transferred? I've been doing it manually, and that's NOT fun!
>
>Thanks!
>Charlie Brune
>
>-
>To unsubscribe, send email to majordomo@silug.org with
>"unsubscribe silug-discuss" in the body.
>
-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.