home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / arexx / scripti.lha / 3-DEE / Scripti / Operation / Remove.new.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1993-05-19  |  1.0 KB  |  39 lines

  1. /*
  2. ------------------------------------------------------------------------------
  3. This program will remove the .new extension(s) of a filename.
  4. The extension is always due to an image processed with
  5.          the 3-DEE-AREXX scripts.
  6.  
  7. Host address: COMMAND
  8. Written by Jan Van Overbeke, 3-DEE, ©1993.
  9. Read the AREXX-Scripti doc, for more info about operation and rights!
  10. ------------------------------------------------------------------------------
  11. */
  12.  
  13. arg filename
  14. if ~exists(filename)|filename='' then do
  15.     say 'Unable to find the file'
  16.     say 'See Ya.......'
  17.     say ''
  18.     exit
  19.     end
  20.  
  21. /* ---- Keep on going until there's no more .NEW ---- */
  22. /* -------------------------------------------------- */
  23. newpos=1
  24. do until newpos=0
  25.     newpos=lastpos('.NEW',filename)
  26.     if newpos=(length(filename)-3) then do
  27.         dest=delstr(filename,newpos)
  28.         if exists(dest) then do
  29.                 say 'removing 'dest
  30.                 doscommand='delete >NIL: 'dest
  31.                 address COMMAND doscommand
  32.                 end
  33.         doscommand='rename 'filename' as 'dest
  34.         filename=dest
  35.         address COMMAND doscommand
  36.         end
  37. end
  38. exit
  39.