I needed a Linux one-liner to pull off a mail move of particular mail from one user to another
cp -p `grep -lr "media" /home/jones/Maildir` /home/jones/holding
In more generic terms, it looks like this:
cp -p `grep -lr "[matching term]" [directory to search]` [destination directory]
the -p option on the copy preserves attributes (so you omit some by date).
I copied these files into a holding directory in Jones' directory so that I could do more work on the files. Then, I moved the finished list to Smith's directory.
mv * /home/smith/Maildir/new
They arrived with the wrong ownership. So, I chowned them to fit the required ownership-- that of the mail group.user intent on downloading the messages
chown smith.smith *
cp -p `grep -lr "media" /home/jones/Maildir` /home/jones/holding
In more generic terms, it looks like this:
cp -p `grep -lr "[matching term]" [directory to search]` [destination directory]
the -p option on the copy preserves attributes (so you omit some by date).
I copied these files into a holding directory in Jones' directory so that I could do more work on the files. Then, I moved the finished list to Smith's directory.
mv * /home/smith/Maildir/new
They arrived with the wrong ownership. So, I chowned them to fit the required ownership-- that of the mail group.user intent on downloading the messages
chown smith.smith *
Comments