pump a large file of many Gigs to the other side of the wall

  • Thread starter Anton van der Steen
  • Start date
A

Anton van der Steen

Hey fellow Perl addicts,

Since long I struggled with the problem to pump large files of many many
Gigs to a different place on a server or netwerk.

Well it took some research, but here is the solution:

1.use perl
2. rename the extension of the file to something exoctic like sex. This is
by far out an unkowm extension not used by Mikrosoft.
3. Use script see below and look at the packages of perl that have to be
installed, it is only one namely File::Find:

#!perl/bin/perl

use File::Find;


my @files = find(\&cleanup, "e:\\");

sub cleanup {


if ((/\.sex$/) ) #|| (/\.fun$/)
{
my $doc_1 = substr($File::Find::name, 0, 2 );
my $doc_2 = substr($File::Find::name, 4 );
my $doc_3 = join "",$doc_1,"/",$doc_2;


open FILE ,"<$doc_3" or die $!;

my $file_out = "e:/dump7/resultaat.txt";
open(OUT,">>$file_out");

while (<FILE>)
{

print OUT ;
}
close FILE;

}
}

4. Eureka !!! a file has born on the other side off the wall.

Otherwise you have to buy expensive tools which can do this,
but no Perl comes to the rescue.

5. Have fun.

Anton Vandersteen
Eindhoven/The Netherlands
 
A

Ala Qumsieh

Anton said:
Since long I struggled with the problem to pump large files of many many
Gigs to a different place on a server or netwerk.

I might be overlooking something, but how is this different from 'copy'?

--Ala
 
N

news reader

Hi Anton,


I'm lost, what you try to achieve, but however some questions /
comments. (assuming you're not trolling)


1.) Why do you search the whole drive e: for your file suffix and thus
potentially multiple files? You'd really like to find all of them?
Couldnt't you just specify the filename(s) on the command line or drag
and drop them onto your perl script icon, which should (though I never
tried myself) pass the file names to @ARGV.

2.) Do you really always want to append to your result file?

3.) How come, that your source and destination file are on different
'sides' of the 'wall' (whatever it means) if source and destination are
located under 'e:'

4.) Why do you once write 'e:\\' and once write 'e:/' ?

5.) Do you know for 100%, that the source files are always text files?
If not and you have an unfortunate files without cr/lf characters your
copy loop might slurp in the entire source file in one shot, which may
explode your memory as you are talking about files of a size of multiple GB.

6.) Why do you close FILE, but not OUT?

7.) What is this 'wall' and the 'side'?

8.) Any context could help to see, why and how perl made the world a
better place for you.

9.) Are you really sure, that there's really no 'exotic' application
with the file suffix '\.[e][x]$' . There are so many weird
applications out there. Who knows? ;-)

10.) Don't you expect, that many members of the newsgroup will filter
out messages containing your choice of suffix in a perl related news group?

11.) Just out of curiousity: What would be the expensive tool, that
would perform the same task?


tot ziens and have fun


N.
 
J

John Bokma

Anton van der Steen said:
2. rename the extension of the file to something exoctic like sex.
This is by far out an unkowm extension not used by Mikrosoft.

So Microsoft left you out the beta test of Microsoft Porn 1.0?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top