Saturday | 23 NOV 2024
[ previous ]
[ next ]

Working on a MOVE command in BASIC

Title:
Date: 2023-04-23
Tags:  

A single line move command is missing from BASIC. It might be doable with a flavour of COPY using the FROM/TO and DELETING flag but I don't seem to have in the PICK flavor.

This is why I wrote my own MOVE command! A fun little side adventure in writing some commands. I want to write a MOVE and a CLONE command to simplify things and it would make universe much more amenable to be scripted.

So far I have the following working:

PRINT 'MOVE - Move Command'
PRINT
PRINT 'Move a file:'
PRINT 'MOVE {SRC.FILE} {SRC.RECORD} {DEST.FILE} {DEST.RECORD}'
PRINT
PRINT 'Move a file without renaming:'
PRINT 'MOVE {SRC.FILE} {SRC.RECORD} {DEST.FILE}'
PRINT
PRINT 'Move files using an active list:'
PRINT 'MOVE {SRC.FILE} {DEST.FILE}'
PRINT
PRINT 'Move a file to the underlying OS:'
PRINT 'MOVE {SRC.FILE} {SRC.RECORD} {/tmp/} {new-name.txt}'
PRINT
PRINT 'Move an active list to a folder:'
PRINT 'MOVE {SRC.FILE} {/tmp/backups/}'
PRINT

The move command deletes after the file has been written to the destination. I also want to wrap this stuff in a transaction block so that a fatal error will roll the system back to a consistent state but I had issues with that so thats left for the future.