3 # nautilus2claws-mail.sh
4 # Copyright 2004 Reza Pakdel <hrpakdel@cpsc.ucalgary.ca>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 3
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 # This script will recursively attach a number of selected
22 # files/directories from Nautilus to a new blank e-mail.
24 # Authors: Reza Pakdel <hrpakdel@cpsc.ucalgary.ca>
25 # Stephan Sachse <white@teg-clan.de>
28 # Stephan Sachse : files/directorys with whitspaces
31 SELECTED_PATHS
="${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}"
32 NB_SELECTED_PATHS
=`echo -n "${SELECTED_PATHS}" | wc -l | awk '{print $1}'`
36 for ((i
=${NB_SELECTED_PATHS}; i
>0; i--
)) ; do
37 CURRENT_PATH
=`echo -n "${SELECTED_PATHS}" | head -n${i} | tail -n1`
38 if test -d "${CURRENT_PATH}" ; then
39 FILES_FOUND
=`find "${CURRENT_PATH}" -type f`
40 NB_FILES_FOUND
=`echo "${FILES_FOUND}" | wc -l | awk '{print $1}'`
41 for ((j
=${NB_FILES_FOUND}; j
>0; j--
)) ; do
42 CURRENT_FILE
=`echo "${FILES_FOUND}" | head -n${j} | tail -n1`
43 ATTACHMENTS
="${ATTACHMENTS} \"${CURRENT_FILE}\""
46 ATTACHMENTS
="${ATTACHMENTS} \"${CURRENT_PATH}\""
53 eval "claws-mail --compose --attach ${ATTACHMENTS}"