in reply to Re: Re: Creating shortcuts
in thread Creating shortcuts

Yes, I tested it. Here is an even more through test that worked perectly on my platform, Win2K, NTFS, Activeperl 5.6.1:

use warnings; use strict; my $file = 'C:/tmp/filename1.txt'; open IN, $file or die "Cannot open $file for reading:$!\n"; print "Contents of $file before linking:\n"; print while (<IN>); close IN; my $link = 'C:/tmp/link.txt'; if (-e $link) { unlink $link or die $!; } link $file,$link or die "Cannot link $link to $file:$!\n"; open LINK, $link or die $!; print "Contents of $link after linking:\n"; print while (<LINK>); close LINK; open (OUT, ">>", $file) or die "Cannot open $file for writing:$!\n"; print OUT "Additional content\n"; close OUT; open IN, $file or die $!; print "Coontents of $file after updating:\n"; print while (<IN>); close IN; open LINK, $link or die "Cannot open $link:$!\n"; print "Contents of $link after updating:\n"; print while (<LINK>); close LINK;
Printed output:

Contents of C:/tmp/filename1.txt before linking: Original contents Contents of C:/tmp/link.txt after linking: Original contents Coontents of C:/tmp/filename1.txt after updating: Original contents Additional content Contents of C:/tmp/link.txt after updating: Original contents Additional content
As you can see, the link is maintained. YMMV on other platforms.

--
Regards,
Helgi Briem
helgi AT decode DOT is

Replies are listed 'Best First'.
Re: Re: Re: Re: Creating shortcuts
by BrowserUk (Patriarch) on Oct 15, 2002 at 12:11 UTC

    I'd never heard of this facility and thought the original post was wrong. However, I can confirm that it does work on NT4 SP6 using AS 5.6.1. Now I just gotta work out some good uses for it.

    The are some caveats though. Q106166

    Kinda reenforces my favorite bugbear with W2K though. Why do I have to waste all that disk storing copies of files that exist in \winnt\system32 in the hidden subdir \winnt\system32\dllcache? Including such important files as winmine.exe 220mb of wasted space! D'oh.

    C:\test>test Contents of ./filename1.txt before linking: This is the contents of filename1.txt Contents of ./link.txt after linking: This is the contents of filename1.txt Coontents of ./filename1.txt after updating: This is the contents of filename1.txt Additional content Contents of ./link.txt after updating: This is the contents of filename1.txt Additional content

    Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!
      Why do I have to waste all that disk storing copies of files that exist in \winnt\system32 in the hidden subdir \winnt\system32\dllcache? Including such important files as winmine.exe 220mb of wasted space! D'oh.

      Same here. I was running low on space on my system drive a while back, didn't have the time to run out and get a new drive. The quick fix was sfc /cachesize=50, where 50 = 50MB. I can't remember if I had to manually clean up the dllcache directory or not ;)

      Look here for documentation, and enjoy all that new disk space - for a few days at least.