Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - rename change the name of a file http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 rename              Change the name of a file
------------------------------------------------------------------------------
 Syntax
   rename cOldFileName to cNewFileName

 Arguments
   cOldFileName is the original file name.
   cNewFileName is the new file name.

 Description
   The rename command changes the name of a file. rename does not allow the
   DOS wildcard characters '*' and '?' to be part of the file name.

 Example
   #define EXAMPLE_FILE
   #include example.hdr

   proc Test_rename
   vardef
      char cOld, cNew
   enddef
   cOld := "test.txt"
   cNew := "newname.txt"
   set alternate to cOld
   set alternate on                                // create file
   ? "Testing the rename command"
   set alternate off
   set alternate to                                // close file
   if exist( cOld ) .and. .not. exist( cNew )
      rename cOld to cNew                          // rename file
      if .not. exist( cOld ) .and. exist( cNew )
         ? "Rename successful"
         erase cNew                                // clean up
      endif
   endif
   endproc

   proc main
   Test_rename()
   endproc

See Also: ren()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson