View Single Post
  #9 (permalink)  
Old August 7th, 2001
SRL SRL is offline
Gnutella Veteran
 
Join Date: March 23rd, 2001
Posts: 144
SRL is flying high
Default

You had to ask huh? ;-)

Well... I'm sure there's easier ways, but I use this perl script...

+++++++++++++++++++++++++++

use Win32::Clipboard;

## remove 2048 bytes from end of file ##
my($tval)=2048;

## use filename from clipboard ##
my($clp) = Win32::Clipboard();
my($fn) = $clp->Get();

($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= lstat($fn);

my($nsize)=$size-$tval;

print "$fn\n\n";
print "$size->$nsize\n";

open(MFILE,"+<$fn") || die "Can't open file\n";
truncate(MFILE, $nsize) || die "Can't truncate\n";
close(MFILE);
+++++++++++++++++++++++++++

It takes the filename from the clipboard and removes $tval bytes from the end (I think the Win32::Clipboard() module was an add-on to perl BTW).
Reply With Quote