From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sharon Kimble Newsgroups: gmane.emacs.help Subject: deleting backup files dependant on their age Date: Mon, 23 Nov 2015 19:46:31 +0000 Message-ID: <874mgcebxk.fsf@skimble.plus.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1448308084 22499 80.91.229.3 (23 Nov 2015 19:48:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Nov 2015 19:48:04 +0000 (UTC) To: help-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 23 20:47:51 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a0x5P-00036s-HZ for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Nov 2015 20:47:39 +0100 Original-Received: from localhost ([::1]:34316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0x5Q-0003q9-7U for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Nov 2015 14:47:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0x4a-0002tn-TJ for help-gnu-emacs@gnu.org; Mon, 23 Nov 2015 14:46:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0x4W-0007N1-42 for help-gnu-emacs@gnu.org; Mon, 23 Nov 2015 14:46:48 -0500 Original-Received: from avasout03.plus.net ([84.93.230.244]:49850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0x4V-0007MR-Uf for help-gnu-emacs@gnu.org; Mon, 23 Nov 2015 14:46:44 -0500 Original-Received: from london.london ([212.56.101.125]) by avasout03 with smtp id l7md1r0032iKkuk017meVL; Mon, 23 Nov 2015 19:46:38 +0000 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=SKu/L7bH c=1 sm=1 tr=0 a=Z6vFUnHZFshV1nOgW1CWSg==:117 a=Z6vFUnHZFshV1nOgW1CWSg==:17 a=0Bzu9jTXAAAA:8 a=EBOSESyhAAAA:8 a=Jw0ohAZaAAAA:8 a=xY1_shhyAAAA:8 a=LlzXLoV6AAAA:8 a=iI7HsYTVAAAA:8 a=-Gb5-kKcfiKBqY4qXRkA:9 a=VmyTZotGshNyTQNY:21 a=lZ0F7KInRAQNU1p1:21 a=QEXdDO2ut3YA:10 a=ARJxn3dPLvGEWEYGAoYA:9 X-AUTH: skimble@:2500 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 84.93.230.244 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108204 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I'm revisiting the age-old problem of deleting backup files, where currently I have 1,383 which is increasing day-by-day. I have this in my init.org - =2D-8<---------------cut here---------------start------------->8--- (setq backup-directory-alist '(("." . "~/.emacs.d/backups/")) backup-by-copying t version-control t delete-old-versions t kept-new-versions 2 kept-old-versions 1) =2D-8<---------------cut here---------------end--------------->8--- but it doesn't seem to be deleting the old files. So I've googled and found this on http://www.emacswiki.org/emacs/BackupDirectory =2D-8<---------------cut here---------------start------------->8--- (message "Deleting old backup files...") (let ((week (* 60 60 24 7)) (current (float-time (current-time)))) (dolist (file (directory-files temporary-file-directory t)) (when (and (backup-file-name-p file) (> (- current (float-time (fifth (file-attributes file)))) week)) (message "%s" file) (delete-file file)))) =2D-8<---------------cut here---------------end--------------->8--- which I've amended to only work on files older than 14 days =2D-8<---------------cut here---------------start------------->8--- #+begin_src emacs-lisp (message "Deleting old backup files...") (let ((fortnight (* 60 60 24 14)) (current (float-time (current-time)))) (dolist (file (directory-files ~/.emacs.d/backups t)) (when (and (backup-file-name-p file) (> (- current (float-time (fifth (file-attributes file)))) fortnight)) (message "%s" file) (delete-file file)))) #+end_src =2D-8<---------------cut here---------------end--------------->8--- but its failing to work, saying this - =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82Symbol's value as variable is void: ~/.emacs.d/backups =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 How then can I set up auto-delete backup files for older than 14 days which are held in "~/.emacs.d/backups" please? Thanks Sharon. =2D-=20 A taste of linux =3D http://www.sharons.org.uk TGmeds =3D http://www.tgmeds.org.uk Debian 8.0, fluxbox 1.3.7, emacs 24.5.1 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJWU20YAAoJEDaBgBkK+INb0aoP/Rm+73RvmfP/ROAl1teTQPQt 1uouV7m8U7UDZ2T9C+Fz3HW5BKBcK+tq/RrXK9SodgI92U51l+K7ZAKst/hwytN/ 2c0fGQ3ieVZVQa9V6wOQtW9mQNNquQ5Q90F5Uno71UtFt8T4ZSFKnNjk+xVlB/6i PXxjZNEBUJ+fFj04ZYoSvncr1kIALet6LfbQExL+zPn2vBq2cfu/97zxkwqbuBv/ rJupIER4klMABTAvCHbgt2AyIGEcRVtTeFVPnP6z6xzsZlV6Ja5e4+pdABXl1rxg GcBbEeOF725/bOzDegq1F131lEaQMrAgl9YTZz4l3/4O07rfZk4JdJea3V7gPD3T +rEpuIN51T946r/IGaehjb6mdepju99k1+qAVxR2Yl1c81Xohjytz3Yj+w44J2nx lb1XwoMtmSiCQJRqzev5huNzNFFrnH9Nj9j+qxUhSkpBaTU0lSWs3/t5U3tfl9r7 lKQ7NDOVtCKfAabsJjRCrYLRteqqdLzez8QPUPlx6z2qgHEIKk2X/7m81z+Mu0ut Ncyyxbq9ip8QQf0Uom98DWT5p7tfia64IsDHs+ErkSs7XE+/tSL5BD+ObW5iNg8s gYcR8HZFhkt0sot9lZuY3cYer1eKH9eCvvh8YozveGPKNkcfBzUMiaDLuewFG45d qqVAh/Iem7IG9Re2XL+D =9GQX -----END PGP SIGNATURE----- --=-=-=--