Brenda Cannon wrote: > $file_type then contains something like 'MooV', etc. Is it possible to > do the same thing in a Windows environment without actually looking for > the extension (the extension won't be there for the problem I have)? If > so, I am looking for a portable way to do this on both platforms. It sort of is, but Windows uses file extensions to tell the OS what "type" of file it is. If you rename the file so that there is no extension then it no longer can tell what type it is (on NT these things are controlled via FTYPEs and ASSOCs). There is additional information that the file system stores (at least on HPFS - I dunno about FAT) on Windows though. The following script should work on both, but it might not give you an interesting $file_type on windows: if ($^O eq 'MacOS') { $file_type = MacPerl::GetFileInfo("$image_dir:$file_name"); } if ($^O =~ 'Win32') { @assoc=`assoc`; @ftype=`ftype`; for (@assoc) { my($ext,$type) = split(/=/,$_); chomp($type); if ($file_name =~ /\Q$ext\E$/) { @file_type = grep(/$type=/,@ftype); $file_type = $file_type[0]; } } if (!$file_type) { require "Win32/AdminMisc.pm"; if (Win32::AdminMisc::GetFileInfo("$image_dir/$file_name", \%file)) { $file_type = "$file{CompanyName} $file{FileVersion} $file{InternalName} $file{OriginalFilename}"; } else { print "Error: ", Win32::FormatMessage(Win32::GetLastError()); } } } __END__ Peter Prymmer ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org