home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
rxmir13.zip
/
cnvnam2.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-02-14
|
669b
|
19 lines
/* REXX script to convert rfc filename to have/not have zeros in it's number */
parse arg nam func .
nam = filespec("NAME",nam)
if length(nam) < 4 then return
if func="pack" then do
dotpos = pos(".",nam)
if dotpos = 0 then dotpos = length(nam)
nums = substr(nam,4,dotpos-4)
do while left(nums,1)="0"; nums = substr(nums,2); end
push substr(nam,1,3)||nums||substr(nam,dotpos)
end
if func="unpack" then do
dotpos = pos(".",nam)
if dotpos = 0 then dotpos = length(nam)
nums = substr(nam,4,dotpos-4)
if length(nums)<4 then nums = copies("0", 4-length(nums))||nums
push substr(nam,1,3)||nums||substr(nam,dotpos)
end