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 - copy file copy a file to a new file http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 copy file           Copy a file to a new file
------------------------------------------------------------------------------
 Syntax
   copy file cSourceName to cTargetName

 Arguments
   cSourceName is the file name to copy from.
   cTargetName is the file name to copy to.

 Description
   The copy file command copies a file from a source to a target name.
   The copy file command can copy database files and any other type of
   files as well.

   If the destination disk gets full during the copy, a runtime error
   results. Use the diskspace() and filesize() functions to check for
   enough free disk space before doing the copy.

 Example
   #define EXAMPLE_FILE
   #include example.hdr

   // This sample allows users to input a list of files into an arrays
   // and copy the files to a target drive.
   
   #define COPYNUM 10
   
   proc Test_copyfile
   vardef
      char( 20 ) aFiles[ COPYNUM ]
      char( 3 )  cDrive
      int        nCount
   enddef
   nCount := 0
   cDrive := ""
   accept "Input target drive (including :\) " to cDrive // get drive name
   repeat
      accept "Input filename " to aFiles[ nCount ]       // get file names
      nCount++
   until nCount >= COPYNUM .or. isempty( aFiles[ nCount - 1 ] )
   for nCount := 0 to COPYNUM - 1                        // copy loop
      if isempty( aFiles[ nCount ] )
         exit
      endif
      ? "Copying file", aFiles[ nCount ], "to", cDrive + aFiles[ nCount ]
      copy file aFiles[ nCount ] to cDrive + aFiles[ nCount ]
   next
   endproc

   proc main
   Test_copyfile()
   endproc

See Also: append from copy to

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