Mike Nelson's PERL Page
- Last modified: November 1997 -
using the perl scripts below in WindowsNT
get a copy of the perl application
Pro/Engineer and Multi-version Medusa file purging script
ProEngineer and Medusa file purging script
This tool will purge files with the extension
"asm", "log", "prt", "txt", "trl", "drw", "inf", "she", and "sym"
The files can be purged keeping a desired number of versions for example the code -n 3 will cause files to be purged to the latest 3 versions. The script will purge in just a single directory or a complete tree of directories and the action can be output to the screen as the files are purged by giving the -p command. For testing the -t command will output to the screen a list of files that will be purged if the command os executed without the -t
finally by adding the -help extension a help script will be printed to the screen
Perl script to sort a list of files into the correct order
File sorting script perl code
The result of a directory listing "ls /b 1.she.*" or "dir /b 1.she.*" of a directory containing 12 versions of the file 1.she will create a list similar to the example below
1.she.1
1.she.10
1.she.11
1.she.12
1.she.2
1.she.3
1.she.4
1.she.5
1.she.6
1.she.7
1.she.8
1.she.9
This is a common problem with the sort facilities available in UNIX, VMS, and DOS
in order to solve this there is a very good tool on PERL that will do a sort that guarantees proper numeric order
I am, of course, refering to the "spaceship operator" <=>.
The file sorting script above uses this.
Modifying the UNIX PERL scripts for use in WindowsNT
Replace the line "#! /usr/sbin/perl " with the following:-
@rem = '--*-Perl-*--';
@rem = '
@echo off
perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
@rem ';
and add the following to the end of the script:-
__END__
:endofperl
Back to the CAD page