我创建了几个脚本来在目录之间移动通过notmuch标记的消息。 notmuch
Maildir
由于拥有多个帐户,我在与 gmail 同步时创建的一些 mbsync 目录的名称存在一些问题。
这是我的Maildir
Gmail 帐户的典型结构:
gmail-user2
├── [Gmail]
│ ├── Brouillons
│ │ ├── cur
│ │ ├── new
│ │ └── tmp
│ ├── Corbeille
│ │ ├── cur
│ │ ├── new
│ │ └── tmp
│ ├── Messages envoy&AOk-s
│ │ ├── cur
│ │ ├── new
│ │ └── tmp
│ ├── Spam
│ │ ├── cur
│ │ ├── new
│ │ └── tmp
│ └── Tous les messages
│ ├── cur
│ ├── new
│ └── tmp
└── Inbox
├── cur
├── new
└── tmp
当我运行以下脚本时:
function safeMove { s=${1##*/}; s=${s%%,*}; mv -f $1 $2/$s; }
echo Moving $(notmuch count --output=files tag:trash and tag:gmail-user2 and not path:/.*/Corbeille/ and not path:/.*/Trash/) trash-tagged mails to gmail-user2 Trash folder
for i in $(notmuch search --output=files tag:trash and tag:gmail-user2 and not path:/.*/Corbeille/ and not path:/.*/Trash/); do
safeMove $i ~/Maildir/gmail-user2/[Gmail]/Corbeille/cur
done
我有以下错误:
mv: cannot stat '/home/user1/Maildir/gmail-user2/[Gmail]/Tous': No such file or directory
mv: cannot stat 'les': No such file or directory
我怎样才能mv
找到该Tous les messages
目录?
编辑:
根据评论中提供的链接我添加了双引号:
function safeMove { s=${1##*/}; s=${s%%,*}; mv -f $1 $2/$s; }
for i in "$(notmuch search --output=files tag:trash and tag:gmail-user2 and not path:/.*/Corbeille/ and not path:/.*/Trash/)"; do
safeMove "$i" ~/Maildir/gmail-user2/[Gmail]/Corbeille/cur
done
现在我有以下错误:
mv: target '/home/user1/Maildir/gmail-user2/[Gmail]/Corbeille/cur/1715687008.294831_40.user1-um450': No such file or directory
当find ~/Maildir/ -name 1715687008.294831_40.user1*
给出:
/home/user1/Maildir/gmail-user2/[Gmail]/Tous les messages/cur/1715687008.294831_40.user1-um450,U=40:2,FS