SysFileMove functionality

2007-04-24
2012-08-14
  • Nils Engerby
    Nils Engerby
    2007-04-24

    I have patiently been waiting for years for a SysFileRename function and today I noticed by accident that the SysFileMove function actually requires a fully qualified path AND file name as the target, so it appears to work just like the ***x mv command.

    The SysFileMove examples from the documentation specifying only the path does not work. This is with OORexx 3.1.1 on Windows XP SP2 and Server 2003.

    Is this working as designed, and can I rely on this behavior for future releases?

    When SysFileMove "moves" a file to a different name in the same directory, is it a true rename or is there some copy/delete/rename sequence involved?

    Nils Engerby - Skandia Informationsteknologi AB, Stockholm, Sweden

     
    • David Ashley
      David Ashley
      2007-04-25

      I modified the docs to reflect the need for a path component in the target. It should appear in the next release of the docs.

       
    • Rick McGuire
      Rick McGuire
      2007-04-24

      The SysFileMove function is just a simple wrapper around the Windows MoveFile() API, which determines how things are actually moved. The MoveFile() documentation is somewhat sparse on how it works or what the requirements are for the second argument:

      http://msdn2.microsoft.com/en-us/library/aa365239.aspx

      As for relying on the behavior, well, that's all in MicroSoft's hands.

      Rick

       
    • Nils Engerby
      Nils Engerby
      2007-04-25

      Thanks for the pointer.

      According to the MS docs, MoveFile() can be used as a method of renaming files, so I'll take their word for it.

      I have a script that is used to manipulate (change/insert/overlay/delete/uppercase/lowercase) the filenames on large batches of files and it runs more than ten times faster when using SysFileMove instead of the external RENAME command.

      However, the OORexx documentation of SysFileMove should be updated to show that the target file name must include the path.

      Nils