From mboxrd@z Thu Jan 1 00:00:00 1970 From: Phil Jackson Subject: Re: Re: create links for all marked files in dired Date: Mon, 26 Nov 2007 12:29:01 +0000 Message-ID: <87y7cli41e.fsf@shellarchive.co.uk> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iwd5C-0003Nh-FT for emacs-orgmode@gnu.org; Mon, 26 Nov 2007 07:29:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iwd5B-0003NB-Q7 for emacs-orgmode@gnu.org; Mon, 26 Nov 2007 07:29:02 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iwd5B-0003N8-LI for emacs-orgmode@gnu.org; Mon, 26 Nov 2007 07:29:01 -0500 Received: from smtp.aaisp.net.uk ([81.187.81.52]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Iwd5B-0007hg-AS for emacs-orgmode@gnu.org; Mon, 26 Nov 2007 07:29:01 -0500 In-Reply-To: (Fabian Braennstroem's message of "Sun\, 25 Nov 2007 17\:17\:17 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Fabian Braennstroem Cc: emacs-orgmode@gnu.org --=-=-= Fabian Braennstroem writes: > Hi Carsten, > > Carsten Dominik schrieb am 11/25/2007 02:22 PM: >> On 11/25/07, Fabian Braennstroem wrote: >>> Hi, >>> me again :-) >>> >>> is there a chance to create links from the marked files in a >>> dired buffer using org-mode internal functions? >>> It would help, when you have a bunch of e.g. images in one >>> directory... >> >> Can you be more specific? How you like the output in Org-mode to >> work? A link back to dired visiting this directory, or many links to >> each individual file? > > Many links to each individual file would be great. > Fabian Off topic, I know, but you could use this as a temporary measure. I've only just knocked it up and not really tested it so I'm sure there is bugs. I might re-factor it soon and give it some options/features. --=-=-= Content-Disposition: inline; filename=dir2org.zsh Content-Description: Zsh shell script #!/usr/bin/env zsh set -e function headline { depth="${1}" text="${2}" printf "%${depth}s %s" "" | tr ' ' '*' echo " ${text}" } function scan_and_populate { depth="${1}" dir="${2}" headline ${depth} "${dir}" let "depth += 1" for f in $(ls -d "${dir}"/* 2>/dev/null); do if [ -d "${f}" ]; then scan_and_populate ${depth} "${f}" else headline ${depth} "[[file://${f}][${${f##*/}%.*}]]" fi done let "depth -= 1" } function main { scan_dir="${1:-$(pwd)}" depth=0 scan_and_populate ${depth} "${scan_dir}" } main "${@}" --=-=-= Cheers, Phil --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--