14.1 C
New York
Tuesday, April 15, 2025

macos – How you can transfer all information *and* folders to the trash from the command line?


Answer: trash command

See this Reply on comparable Query, How you can transfer information to trash from command line?.

macOS 15 Sequoia provides a brand new command-line device: trash

To empty the present folder, merely run:

trash *

All information, and all folders, are moved to the person’s Trash folder.

The man web page says:

TRASH(8)                                                                      System Supervisor's Guide                                                                     TRASH(8)

NAME
     trash – Strikes information and directories to the person trash folder

SYNOPSIS
     trash [-h] [--help] [-s] [-stopOnError] [-v] [--verbose] FILE [FILE...]

DESCRIPTION
     The trash strikes information and directories into the person trash folder.  The choices are as follows:

     -h | --help
                show utilization info for the device and exit

     -v | --verbose
                show extra verbose standing

     -s | --stopOnError
                exit with an error if any transfer to a trash folder fails

EXAMPLES
     In a listing with a file named "Foo.txt" and a listing "Bar",

     trash Foo.txt Bar

     strikes the file and listing into the person's trash folder, if it exists and permissions permit the objects to be moved into the person's trash folder.

HISTORY
     First appeared in macOS 14.0

macOS
Might 25, 2022                                                                          

Reportedly that final line about being in macOS 14 Sonoma is wrong. Folks say solely 15 Sequoia and later has trash command.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles