BB___NAME_AS

=NAME..AS= toc

Description
> This command is used to rename and move files and folders. > The destination must not exist or you receive a hard error.

Rename a file

 * 1) name //fileName$1// as //fileName$2//

Move a file
> //NOTE: The file can be renamed when moved.//
 * 1) name //path\fileName$// as //newPath\fileName$//

Usage
code format="lb" ' Rename a file name "JanTots.dat" as "FebTots.dat" ' or... name "JanTots.dat" as "JanTots.bak"

' Move a file name "JanTots.dat" as "backup\JanTots.bak" code

Example
code format="lb" ' To make a backup of a file and move it to a backup folder. ' Assumes "backup" exists as a sub-folder of the current folder

' Open file to read open "JanTots.dat" for input as #1

' Open file for backup open "JanTots.bak" for output as #2

' Read file contents txt$ = input$(#1, lof(#1))

' Write contents to backup file print #2, txt$

' Close the files close #1 close #2

notice chr$(13);"Backup file successfully created";chr$(13);_ "Will now move file to backup folder..."

' Move backup file to backup folder ' Check if file exists on error goto [ohoh]

name "JanTots.bak" as "backup\JanTots.bak" notice "Backup complete." end

' Error handler [ohoh] if Err = 58 then print "File already exists." print "Program ending." end code

Useful Functions
code format="lb" Place a useful function using this command here code