How to remove cur and new mail via ssh

To remove the cur and new files via SSH, you can use the following commands:

Remove cur files:

ssh user@remote_server "find /path/to/mailbox -type f -name cur -delete"

Replace user with your username, remote_server with the hostname or IP address of the remote server, and /path/to/mailbox with the path to the mailbox directory.

Remove new files:

ssh user@remote_server "find /path/to/mailbox -type f -name new -delete"

Again, replace user with your username, remote_server with the hostname or IP address of the remote server, and /path/to/mailbox with the path to the mailbox directory.

Remove both cur and new files:

ssh user@remote_server "find /path/to/mailbox -type f \( -name cur -o -name new \) -delete"

This command uses a shell pattern to match both cur and new files.

Note:

Also, you can use ssh with -t option to run the command in a pseudo-TTY, which can be useful if you need to interact with the remote shell:

ssh -t user@remote_server "rm /path/to/mailbox/cur* && rm /path/to/mailbox/new*"

This command will remove both cur and new files in the specified mailbox directory.