[pm-h] Help building Shortcut; Need make.exe for PC
Mike Flannigan
mikeflan at att.net
Fri Sep 26 16:08:20 PDT 2008
Haufler, Wayne A wrote:
> I have been trying to write a short Perl script on a PC (ActivePerl)
> that would replace duplicate copies of huge video files with Shortcuts
> to the corresponding original video files. To do this, I need and
> acquired the Win32::Shortcut module from CPAN.
>
> The Shortcut's README file claims "You can always find the latest
> version of this package online at:
> http://www.divinf.it/dada/perl/shortcut
>
> But that dada directory does not appear to exist.
>
> In Win32-Shortcut-0.07\docs\intro.html
>
> Installation Instructions
> 1. Run the INSTALL.BAT program.
> 2. Run the TEST.PL script to see if everything works
>
> Whereas, the only two files in the eg directory are: ln32.bat and
> sample.pl.
>
> Anyway, somewhere I found build instructions involving make.
> Shortcut does come with a Makefile and a Makefile.pl.
> I understand Makefile.pl is used with ExtUtils:MakeMaker to generate the
> Makefile.
>
> I'm familiar with make in the Unix world (years ago), but
> can't seem to acquire any form of make program for the PC world.
>
> I do have Cygwin installed (though not the entire package),
> but no version of make.exe or gmake.exe is found there.
>
> Must I reinstall the WHOLE Cygwin package? to get make.exe?
>
> Also am aware of minGW and MSYS and tried to install them for their
> (supposed) version of make, but keep running into obstacles.
>
> I know, I should ask the Perl::Win32::users list (or similar).
>
That sounds like it would be a handy a program. It also
sounds like it would be relatively easy to create. I'm not
sure this is what you want, but I will recommend this
basic structure for traversing the disk.
use strict;
use warnings;
use File::Find;
$| = 1; #Autoflush STDOUT
#finddepth comes from File::Find
#finddepth searches from the bottom of the tree up
my $folder = "C:/Copy";
finddepth(\&Replace, $folder);
sub Replace{
#NOTE: finddepth chdirs to the directory it's
# traversing and sets the filename to $_.
# $File::Find::name is the full path to the file
unless (/\.$/) {
my $origname = $_;
s/#/no/g; # Or do something else here
rename $origname,$_ or die "Couldn't rename $origname!";
print "File: $origname - $_\n" if (/\./);
print "Directory: $origname - $_\n" unless (/\./);
}
}
__END__
I have never used the win32::Shortcut module.
I guess you should create a hash whose key (or
value) is the path and name of the original file. How
you figure out it is a duplicate is another problem.
If you ever hear of some Perl get-togethers down here in
Clear Lake, please let me know.
Mike
More information about the Houston
mailing list