GNU   davin.50webs.com/research
Bringing to you notes for the ages

       Main Menu          Research Projects         Photo Album            Curriculum Vitae      The Greatest Artists
    Email Address       Computer Games          Web Design          Java Training Wheels      The Fly (A Story)   
  Political Activism   Scruff the Cat       My Life Story          Smoking Cessation          Other Links      
Debugging Macros     String Class I     Linked List System I Java for C Programmers Naming Convention
    String Class II         How I use m4              Strings III                 Symmetrical I/O             Linked Lists II     
Run-Time Type Info   Virtual Methods      An Array System        Science & Religion            Submodes       
  Nested Packages      Memory Leaks    Garbage Collection      Internet & Poverty      What is Knowledge?
Limits of Evolution   Emacs Additions      Function Plotter           Romantic Love        The Next Big Thing
    Science Fiction     Faster Compilation Theory of Morality         Elisp Scoping               Elisp Advice      
  S.O.G.M. Pattern       Safe Properties         School Bullying          Charisma Control          Life and Death    
     Splitting Java          Multiple Ctors       Religious Beliefs         Conversation 1           Conversation 2    
   J.T.W. Language    Emacs Additions II      Build Counter             Relation Plotter          Lisp++ Language  
  Memory Leaks II   Super Constructors CRUD Implementation Order a Website Form There Is An Afterlife
More Occam's Razor C to Java Translator Theory of Morality II


bak.el

    

;;; bak.el

;; Copyright (C) 2014-2015 Davin Pearson

;; Emacs Lisp Archive Entry
;; Filename: bak.el
;; Author/Maintainer: Davin Max Pearson <http://davin.50webs.com>
;; Keywords: Unix Backup
;; Version: 1.0

;;; Commentary:

;; This file is not part of GNU Emacs.

;;; Limitation of Warranty

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs, see the file COPYING.  If not, see:
;;
;; <http://www.gnu.org/licenses/gpl-3.0.txt>.


;;; Known Bugs:

;; None so far!

;;; Code:

(defun bak-dir ()
  (safe-expand-file-name "~/bak/"))

;;  (cond
;;   (os-type--linux-p     (expand-file-name "~/bak/"))
;;   (os-type--microsoft-p (expand-file-name "~/bak/"))
;;   (t                    (expand-file-name "/bak-unix/")))
;;  )

;;;
;;; (bak--get-bases (setq dirname "~/bak") (setq extension ".zip"))
;;;
(defun bak--get-bases (dirname extension)
  (let* ((list (directory-files dirname nil extension))
         (ptr  list))
    (assert (or (string-match "\\.tar\\.gz$" extension)
                (string-match "\\.tar$"      extension)
                (string-match "\\.zip$"      extension)
                (string-match "\\.pdf$"      extension)
                ))
    (while ptr
      (if (string-match (concat "\\(^.*\\)" bak--yyyymmdd bak--hhmmss (regexp-quote extension) "$") (car ptr))
        (setcar ptr (substring (car ptr) (match-beginning 1) (match-end 1)))
        (setcar ptr nil))
      (setq ptr (cdr ptr)))
    (setq list (delete-duplicates list :test 'string=))
    (setq list (delete nil list))
    list))

;; NOTE:               Y    Y    Y    Y    M    M    D    D
(setq bak--yyyymmdd "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]")

;; NOTE:             h    h    m    m    s    s
(setq bak--hhmmss "-[0-9][0-9][0-9][0-9][0-9][0-9]")

;;;
;;; (bak--test-yyyymmdd  (setq dir "~/bak/frog/") (setq extension ".tar"))
;;; (bak--test-yyyymmdd  (setq dir "~/bak/")      (setq extension ".tar"))
;;;
(defun bak-test-inner (dirname extension)
  "Used by bak.el function bak--copy-to-other-drive--internal--internal
and cull-same-dates.el function ??? and cull-size-quota ???"

(if (not (file-exists-p dirname))
      (debug))

(let* ((list (directory-files-no-subdirs dirname
                                           nil
                                           (concat bak--yyyymmdd
                                                   extension))))

    ;;(debug)

    (if list
        (error "Directory %s not found YYYYMMDD format file(s) %s" dirname list))))

;;;
;;; (bak--test-yyyymmdd "~/bak/frog/" ".tar")
;;;
(defun bak-test (dirname)
  (interactive "DEnter dir: ")
  ;;(bak--test-yyyymmdd dirname "\\.[^.]*$")
  (bak-test-inner dirname ".zip")
  (bak-test-inner dirname ".tar")
  (bak-test-inner dirname ".tar.gz")
  ;;(bak-test-inner "~/bak/frog/" "\\.tar$")
  )

(if os-type--microsoft-p
    (safe-require 'bak-windows))
(if os-type--linux-p
    (safe-require 'bak-unix))

(progn
  (safe-require 'cull-same-dates)
  (safe-require 'cull-size-quota)
  (safe-require 'duplicate-files)
  (safe-require 'datify)
  (safe-require 'demises)
  )

(provide 'bak)
Back
| Main Menu | Research Projects | Photo Album | Curriculum Vitae | The Greatest Artists |
| Email Address | Computer Games | Web Design | Java Training Wheels | The Fly (A Story) |
| Political Activism | Scruff the Cat | My Life Story | Smoking Cessation | Other Links |
| Debugging Macros | String Class I | Linked List System I | Java for C Programmers | Naming Convention |
| String Class II | How I use m4 | Strings III | Symmetrical I/O | Linked Lists II |
| Run-Time Type Info | Virtual Methods | An Array System | Science & Religion | Submodes |
| Nested Packages | Memory Leaks | Garbage Collection | Internet & Poverty | What is Knowledge? |
| Limits of Evolution | Emacs Additions | Function Plotter | Romantic Love | The Next Big Thing |
| Science Fiction | Faster Compilation | Theory of Morality | Elisp Scoping | Elisp Advice |
| S.O.G.M. Pattern | Safe Properties | School Bullying | Charisma Control | Life and Death |
| Splitting Java | Multiple Ctors | Religious Beliefs | Conversation 1 | Conversation 2 |
| J.T.W. Language | Emacs Additions II | Build Counter | Relation Plotter | Lisp++ Language |
| Memory Leaks II | Super Constructors | CRUD Implementation | Order a Website Form | There Is An Afterlife |
| More Occam's Razor | C to Java Translator | Theory of Morality II
Last modified: Sat Apr 29 18:38:25 NZST 2017
Best viewed at 800x600 or above resolution.
© Copyright 1999-2017 Davin Pearson.
Please report any broken links to