MoveFile
MoveFile SourceFilename$, OuputFilename$
 
Parameters:

    SourceFilename$ = The Filename of the file you wish to move
    OuputFilename$ = The Filename/Path that you wish to move the source file to.
Returns: NONE
 

      MoveFile will move a file.


FACTS:


      * Before you use MoveFile, always make sure that source filename exists. If you try and move a file that doesn't exist, PlayBASIC will return a run time error.

      * MoveFile can also be used to rename a file. Simply move the file to the same location with a new name. (See GetFileName$(), GetFolderName$() for how to split folder/filenames from strings)




Mini Tutorial:


      This example will create a blank file on the C: Drive called "TestFile.txt" , it then copies this file and displays the info about it. Both files are then removed before the program ends.


  
; Create a variable for the Source files name
  SrcFilename$="C:\TestFile.txt"
  
; Create a variable for the output files name
  OutputFilename$="C:\TestFile_Moved.txt"
  
; Make the blank file, 100 bytes in size to copy
  MakeFile SrcFilename$,100
  
; Move the Source File to the Output File
  MoveFile SrcFilename$,OutputFilename$
  
; display the info about the source file
  Print "File Name:"+SrcFilename$
  Print "File Exist:"+Str$(FileExist(SrcFilename$))
  
  
; display the info about the moved file
  Print "File Name:"+OutputFilename$
  Print "File Exist:"+Str$(FileExist(OutputFilename$))
  Print "File Size:"+Str$(FileSize(OutputFilename$))
  
; now delete this file, as it's no use to use anymore
  DeleteFile OutputFilename$
  
  
; Display the screen and wait for a key press
  Sync
  WaitKey
  
  


This example would output.

  
  File Name:C:\TestFile.txt
  File Exist:0
  File Name:C:\TestFile_Copied.txt
  File Exist:1
  File Size:100
  

 
Related Info: CopyFile | DeleteFile :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com