If I understand you right, you want to have the attachments have filename like Sum123.pdf
instead of homecdeSum123.pdf
. I assume the latter name is produced by your mail program that removes the slashes in the path name when saving.
I think you should use a different way to call uuencode
, removing the path name on the second parameter:
find /home/cde -ctime -1 -name "Sum*pdf*" | while read name; do uuencode "$name" "${name##*/}" | mailx -s "subject" [email protected]; done
This will send a separate mail for every file. The ${name##*/}
part will take the variable $name
, remove everything up to and including the last slash and return the result.
If you want to send all files in one mail, just put the mailx
part of the pipe to the end:
find /home/cde -ctime -1 -name "Sum*pdf*" | while read name; do uuencode "$name" "${name##*/}"; done | mailx -s "subject" [email protected]