From: Sharon Kimble <boudiccas@skimble.plus.com>
To: help-emacs <help-gnu-emacs@gnu.org>
Subject: deleting backup files dependant on their age
Date: Mon, 23 Nov 2015 19:46:31 +0000 [thread overview]
Message-ID: <874mgcebxk.fsf@skimble.plus.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2134 bytes --]
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 -
--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)
--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
--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))))
--8<---------------cut here---------------end--------------->8---
which I've amended to only work on files older than 14 days
--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
--8<---------------cut here---------------end--------------->8---
but its failing to work, saying this -
╭────
│Symbol's value as variable is void: ~/.emacs.d/backups
╰────
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.
--
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.0, fluxbox 1.3.7, emacs 24.5.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
next reply other threads:[~2015-11-23 19:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 19:46 Sharon Kimble [this message]
2015-11-23 20:14 ` deleting backup files dependant on their age Eli Zaretskii
2015-11-24 0:01 ` Emanuel Berg
2015-11-24 0:58 ` Emanuel Berg
[not found] ` <mailman.585.1448326084.31583.help-gnu-emacs@gnu.org>
2015-11-24 4:46 ` Dan Espen
2015-11-25 1:26 ` Emanuel Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874mgcebxk.fsf@skimble.plus.com \
--to=boudiccas@skimble.plus.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.