When using the Download Director from IBM, a file is created called dlmgr.pro. This file is created in the directory that you download your files to. I have often found it annoying with the naming convention of files that I download to determine what a file is after I have downloaded it and left it for a while. I found that the dlmgr.pro file does contain pretty much all the info needed to identify the file information. So I thought I would create a quick perl script to parse the file. It is not the prettiest script, but it does what I need.
The script requires the path and file name to the dlmgr.pro file as an argument, and then creates a file called dlmgr.csv in the current directory.
Click here to download
Hi,
ReplyDeleteThere might be a bit of a bug - line 7 is missing a closing semi-colon.
Even after fixing that, it hasn't created the csv file in my directory :(
Great idea though!
Hi Robert,
ReplyDeleteThanks for pointing that out. I guess when I cleaned up some stuff, I forgot to test it again. That will teach me to whip up a quick script ;)
It is fixed now.
Enjoy
Nice!
ReplyDeleteHow about a MDL for an Universal Agent which monitors my download directory?
:)
I know I'm beating a dead horse, but:
ReplyDelete1. I really like this script
2. More people should be leaving comments on this blog ;)
The titles of the files sometimes have commas in them - messing up the csv.
I added this line just before printing to fix that:
$filelist{$dlmgr_file}{title} = ~s/,/;/g;
Hi Robert,
ReplyDeleteInteresting, I guess I was lucky enough not to download one with a comma in the name. Of course that is something that I should have anticipated ;)
Anyway, I have added that to the file available for download.
Thanks again for the feedback.
I wrote a similar script last year out of the same frustration.
ReplyDeleteI wanted the files renamed such that they were abbreviated, yet maintained the product code and version info.
Its more "intrusive" because it actually renames the files, but a simple hack can take care of that.
jdsmedia@deantp1 /cygdrive/c/DownloadDirector
$ ls
C473DIE.exe dlmgr.pro
jdsmedia@deantp1 /cygdrive/c/DownloadDirector
$ cat dlmgr.pro
prompt=false
dir=C:\DownloadDirector
unpackDir=C:\DownloadDirector
family=esdDownloadV2
.file=C473DIE
..title=IBM Tivoli Enterprise Console (TME New Installations) V3.8 Multi
..size=511275008
..sha=A1F6199791CF3919CCFE6D32666730061B9CA38F
..stat=1
..name=C473DIE.exe
..path=C:\DownloadDirector
..crc=3361542140
..date=1032401529
.allFiles=false
.srvURL=http://www16.software.ibm.com/tqd
jdsmedia@deantp1 /cygdrive/c/DownloadDirector
$ /usr/local/bin/parse_ddpro.pl
PWD is /cygdrive/c/DownloadDirector
mv C473DIE.exe IBM_Tivoli_Enterprise_Console_TME_New_Installations_V3_8_Multi_C4
73DIE.exe
-- < snip > --
#!/usr/bin/env perl
#
# Written by Jim Sander (dev@jdsmedia.net)
#
# Rename the files created by Download Director
# to something meaningful
%subtext = (
'IBM Tivoli Provisioning Manager','ITPM',
'Intelligent Orchestrator and Provisioning Manager', 'IOandPM',
'Software','SW',
'Inventory','INV',
'IBM Tivoli Intelligent ThinkDynamic Orchestrator','IntellThinkDynOrch',
'IBM Tivoli Monitoring','ITM',
'Netcool_OMNIbus','NC_OMNI',
'Netccol_OMNIbus','NC_OMNI',
);
printf("PWD is $ENV{PWD}\n");
#chdir($ENV{PWD});
die("No File found for $ARGV[0]\n") if ($ARGV[0] && ! -f $ARGV[0]);
$defpro = ($ARGV[0])?$ARGV[0]:"dlmgr.pro";
open(PRO, "< $defpro") || die("Can't open $defpro : $!");
while (<PRO>){
s/^\.+//;
chomp;
($left,$right)=split('=');
if ($left =~ /file/){
push(@cmds, sprintf("mv %s %s_%s.%s\n",
$stanza{$file}{name},
$stanza{$file}{title},
$file,
$stanza{$file}{suffix})) if ($file);
$file = $right;
next;
}
next unless ($file =~ /\S+/);
if ($left =~ /title/){
foreach $string (keys %subtext){
$right =~ s/$string/$subtext{$string}/g;
}
$stanza{$file}{title} = $right;
$stanza{$file}{title} =~ s/\s+$//;
$stanza{$file}{title} =~ s/^\s+//;
$stanza{$file}{title} =~ s/\s/_/g;
$stanza{$file}{title} =~ s/[\\\/\.]/_/g;
$stanza{$file}{title} =~ s/[:\(\),]/_/g;
$stanza{$file}{title} =~ s/__/_/g;
}elsif ($left =~ /name/){
$stanza{$file}{name} = $right;
$stanza{$file}{suffix} = $1 if ($right =~ /\.(\S+)$/);
}
}
push(@cmds, sprintf("mv %s %s_%s.%s\n",
$stanza{$file}{name},
$stanza{$file}{title},
$file,
$stanza{$file}{suffix})) if ($file);
foreach (@cmds) {
printf;
system("$_");
}
-- < /snip > --