Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MOVE

The MOVE keyword relocates or renames files within the bot’s drive storage.


Syntax

MOVE "source" TO "destination"
result = MOVE "source" TO "destination"

Parameters

ParameterTypeDescription
sourceStringCurrent path of the file
destinationStringNew path for the file

Description

MOVE transfers a file from one location to another within the bot’s storage. The original file is removed after the move completes. This keyword can also be used to rename files by moving them to a new name in the same directory.

Use cases include:

  • Organizing files into folders
  • Renaming files
  • Archiving processed files
  • Moving uploads to permanent storage

Examples

Basic File Move

' Move a file to a different folder
MOVE "inbox/document.pdf" TO "processed/document.pdf"
TALK "File moved to processed folder"

Rename a File

' Rename by moving to same directory with new name
MOVE "reports/report.pdf" TO "reports/sales-report-2025.pdf"
TALK "File renamed successfully"

Move After Processing

' Process file then move to archive
content = READ "incoming/data.csv"
' ... process the data ...

MOVE "incoming/data.csv" TO "archive/data-" + FORMAT(NOW(), "YYYYMMDD") + ".csv"
TALK "Data processed and archived"

Organize User Uploads

' Move uploaded file to user's folder
HEAR uploaded_file

temp_path = UPLOAD uploaded_file TO "temp"
permanent_path = "users/" + user.id + "/documents/" + uploaded_file.name

MOVE temp_path.path TO permanent_path
TALK "File saved to your documents"

Move with Category

' Organize files by type
file_type = GET_FILE_TYPE(filename)

SWITCH file_type
    CASE "pdf"
        MOVE "uploads/" + filename TO "documents/" + filename
    CASE "jpg", "png"
        MOVE "uploads/" + filename TO "images/" + filename
    CASE "csv", "xlsx"
        MOVE "uploads/" + filename TO "data/" + filename
    CASE ELSE
        MOVE "uploads/" + filename TO "other/" + filename
END SWITCH

TALK "File organized into " + file_type + " folder"

Batch Move

' Move all files from one folder to another
files = LIST "temp/"

FOR EACH file IN files
    MOVE "temp/" + file.name TO "permanent/" + file.name
NEXT

TALK "Moved " + LEN(files) + " files"

Return Value

Returns an object with move details:

PropertyDescription
result.sourceOriginal file path
result.destinationNew file path
result.sizeFile size in bytes
result.moved_atTimestamp of move operation

Error Handling

ON ERROR RESUME NEXT

MOVE "documents/report.pdf" TO "archive/report.pdf"

IF ERROR THEN
    PRINT "Move failed: " + ERROR_MESSAGE
    TALK "Sorry, I couldn't move that file."
ELSE
    TALK "File moved successfully!"
END IF

Common Errors

ErrorCauseSolution
FILE_NOT_FOUNDSource doesn’t existVerify source path
PERMISSION_DENIEDAccess blockedCheck permissions
DESTINATION_EXISTSTarget file existsDelete target first or use different name
SAME_PATHSource equals destinationUse different destination

Move vs Copy

OperationSource AfterUse When
MOVEDeletedRelocating or renaming
COPYPreservedCreating duplicates
' MOVE: Original is gone
MOVE "a/file.txt" TO "b/file.txt"
' Only exists at b/file.txt now

' COPY: Original remains
COPY "a/file.txt" TO "b/file.txt"
' Exists at both locations

Behavior Notes

  • Atomic operation: Move completes fully or not at all
  • Creates directories: Parent folders created automatically
  • Overwrites by default: Destination replaced if exists
  • Cross-folder: Can move between any directories in storage

Configuration

No specific configuration required. Uses bot’s standard drive settings from config.csv:

name,value
drive-provider,seaweedfs
drive-url,http://localhost:8333
drive-bucket,my-bot

  • COPY — Duplicate files
  • DELETE FILE — Remove files
  • READ — Read file contents
  • WRITE — Write file contents
  • LIST — List directory contents
  • UPLOAD — Upload files to storage

Summary

MOVE relocates or renames files within storage. The original file is removed after the move. Use it to organize files, rename documents, archive processed data, and manage user uploads. Destination directories are created automatically.