I have a script that saves to DB content of piped to it file.
cat /mailpath/Maildir/cur/mailfile | php -q /scriptpath/mailPipe.php
I need a shell script or oneliner to find all files in Maildir, pipe them to php script and delete every file after that.
I know how to find and pipe every single file to PHP
find /mailpath/Maildir/cur/ -type f -printf "cat %p | php -q /scriptpath/mailPipe.php\n" | sh
But don't know how to delete files after—I don't won't to experiment with rm
P.S. If someone needs similar script: https://github.com/stuporglue/mailreader
rm, you shouldn't be doing this--unless the data you're messing with can be lost without consequences.rmis just a command that deletes files; whether you do it withfind -deleteorrmor something else, the end result is the same. Make--and test!--your backups first.