From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Xah Lee" Newsgroups: gmane.emacs.bugs Subject: bug#4408: 23.1; suggestion: a elisp function for copying and deleting whole dir Date: Fri, 11 Sep 2009 13:05:28 -0700 Message-ID: <8439E9C1352F4A93BB772F169C434480@xahPC> Reply-To: Xah Lee , 4408@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=original Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1252738231 11297 80.91.229.12 (12 Sep 2009 06:50:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Sep 2009 06:50:31 +0000 (UTC) To: Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 12 08:50:24 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MmMRC-0000an-4Y for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Sep 2009 08:50:22 +0200 Original-Received: from localhost ([127.0.0.1]:56319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MmMRB-0001Xh-Bn for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Sep 2009 02:50:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MmCi3-0000QH-Dl for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2009 16:27:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MmChy-0000Ld-Iv for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2009 16:27:07 -0400 Original-Received: from [199.232.76.173] (port=48896 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MmChy-0000LB-Eg for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2009 16:27:02 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:38665) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MmChx-0007Ic-JC for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2009 16:27:01 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8BKQxka021086; Fri, 11 Sep 2009 13:26:59 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n8BKF49K019154; Fri, 11 Sep 2009 13:15:04 -0700 Resent-Date: Fri, 11 Sep 2009 13:15:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: "Xah Lee" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Fri, 11 Sep 2009 20:15:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 4408 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.125269954017848 (code B ref -1); Fri, 11 Sep 2009 20:15:03 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 11 Sep 2009 20:05:40 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8BK5dfD017845 for ; Fri, 11 Sep 2009 13:05:40 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MmCNG-0004HG-L8 for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2009 16:05:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MmCNG-0004GX-31 for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2009 16:05:38 -0400 Original-Received: from [199.232.76.173] (port=53556 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MmCNF-0004GQ-Vz for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2009 16:05:38 -0400 Original-Received: from mout.perfora.net ([74.208.4.194]:62344) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MmCNF-00042S-E0 for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2009 16:05:37 -0400 Original-Received: from xahPC (c-76-102-12-87.hsd1.ca.comcast.net [76.102.12.87]) by mrelay.perfora.net (node=mrus0) with ESMTP (Nemesis) id 0MKp8S-1MmCNC3e3W-000OdK; Fri, 11 Sep 2009 16:05:36 -0400 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6002.18005 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18005 X-Provags-ID: V01U2FsdGVkX18CXvI5G7XcHdUrVED6dCQi9LTGv/4yuRKPIi8 nLcoGjAezgOndufYAV7NQiNXoHceptPvb45wLrUYXDviNmxARG UuKemnwIo7CkqVaXY1/Ow== X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-MIME-Autoconverted: from 8bit to quoted-printable by rzlab.ucr.edu id n8BKQxka021086 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Fri, 11 Sep 2009 16:27:06 -0400 X-Mailman-Approved-At: Sat, 12 Sep 2009 02:50:15 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:31002 Archived-At: it appears to me, this is a good suggestion. there lacks a function to copy and delete directories recursively. in the elisp manual, the closest is: (info "(elisp) Create/Delete Dirs") it would be good to have a function that copy a whole dir, and another fo= r=20 deleting whole dir. Emacs does implement them in dired, or in eshell, apparently, but it's no= t=20 easy to use them. many scripting langs provide such functions, and is very convenient. for deleting dir, perhaps this can be implemented: (delete-directory dirname &optional recursive) for copying dir, perhaps it can be modeled on copy-file: -- Command: copy-file oldname newname &optional ok-if-exists time these should be perhaps few hours to implement for elisp developers, perh= aps=20 by just pulling existing implementation from dired or eshell. Once implemented, they'd be standard functions in elisp manual. They woul= d=20 be great convience for average elisp coders. As a personal example, i needed to both copy dir recursively and also del= ete=20 whole dir, in my use of elisp as a text processing lang. So far i've been= =20 just calling shell. e.g. (shell-command (concat "cp -R " fromDir " " toDir)) (shell-command (concat "find " destDir " -type d -name \"xx*\" -exec rm -= R=20 {} \\;")) my script worked well in the past 2 years, but replying on unix shell has= =20 many complications. For example, recently i need my script to work on=20 Windows. With Windows, there's many complications, e.g. which unix shell = you=20 use cygwin, msys, their config, their path env var config in emacs, both = are=20 inter-related to which emacs distribution one is using (e.g. what shell r= uns=20 when you do M-x shell). Then, recently in one emacs distro i'm trying out= =20 eshell (in hope that it perhaps more cross-platform than M-x shell or=20 Lennart emacsW23's shell, cmd-shell, msys-shell), but discovered that esh= ell=20 chocks on this standard bash syntax find -name "*el" -exec rm {} \; (reported in bug #4406. Doesn't work when called as shell-command neither= ) In short, something trivial turns out to be 5 or more hours to trying to = get=20 it work. emacs + elisp is a great text processing lang, and one big advantage is t= hat=20 it is cross platform. So, all things considered, i think the suggestion i= n=20 this report is a very good one, in particular its ratio of=20 impact/ease-to-implement is relatively high. if i eventually got a solution from looking into dired or eshell for=20 copying/deleting dir, i'll update this report with code for draft=20 implementation. Thanks. Xah =E2=88=91 http://xahlee.org/ =E2=98=84=20