TrFile_MoveToTrash (function reference)

Troi File Plug-in > Functions reference > TrFile_MoveToTrash
Troi File Plug-in for FileMaker Pro

TrFile_MoveToTrash

Moves a file or folder to the trash bin (recycle bin).

SyntaxFunction badge

TrFile_MoveToTrash( switches ; sourcePath )

Parameters

switches not used, reserved for future use. Leave blank or put "-Unused"
sourcePath the path to the file or folder you want to move to the trash

Returned Result

Data type returned

Error code

Result

The returned result is an error code. An error always starts with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:

0 no error The item was moved to the trash
$$-43 fnfErr Source file or folder was not found
$$-1426 errFSOperationNotSupported This kind of item can’t be moved to the trash
$$-4414 kErrVolumeHasNoTrash This volume does not support a trash

Other errors may be returned.

Originated in

Troi File Plug-in 18.0

Compatibility

FileMaker Pro 19 to FileMaker Pro 26

Considerations

The file or folder is not deleted but is moved to the trash. The items will be deleted when the user empties the trash.
On Windows the Trash is called Recycle Bin. On macOS the trash can also be called Bin.

You can’t move a volume (hard disk) to the trash, in this case the function returns error code $$-1426 (errFSOperationNotSupported).

Quite a few external volumes or network disks don’t support moving items into the trash. In this case, if you try to move a file or folder into the trash, the plug-in will return error code $$-4414 (kErrVolumeHasNoTrash). You can then opt for deleting the item directly, with the TrFile_DeleteFile or TrFile_DeleteFolder function.

Example

Set Variable [ $ErrorCode ; TrFile_MoveToTrash ( "-Unused" ; "D:\Report2016.pdf"  ) ]

This will move the file Report2016.pdf to the trash. This file will be deleted if the trash is emptied.

Example 2

Set Variable [ $ErrorCode ; TrFile_MoveToTrash ( "-Unused" ; 
                                                   "/Mac HD/Users/ad/Documents/My Temp Folder"  ) ]

This will move the folder My Temp Folder (and its contents) to the trash.

Used in example file

FileManipulation.fmp12

Related functionsFunction badge

TrFile_DeleteFile
TrFile_DeleteFolder

Related script stepScript step badge

Move To Trash

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 19 to 2026 –> TrFile_MoveToTrash (filep4334) 2026-0716 18:39:37

Share
troi.com
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping us to understand which sections of the website you find most interesting and useful.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.