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:
- Make sure to replace
user
andremote_server
with the correct values. - Be careful when using the
-delete
option, as it permanently deletes files without prompting for confirmation. - If you're using a remote server with a different file system or permissions, you may need to adjust the command accordingly.
- If you're using a mail client like mutt or pine, you may want to check the documentation for specific commands to remove
cur
andnew
files.
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.