lazyload the images

最新精選 Featured post

異世界穿越作品整合

訂閱

訂閱 FB 專頁

每月雙數周日為固定發佈日

訂閱FB 專頁,有新發佈時將會立即看見。
Youtube 頻道經常會有電玩錄影

07/12/2019

use cmd, bat to archive, backup folders or repository

文章分類: , ,

How to use batch script(.bat) to archive and compress folders
如何使用(.bat) 備份檔案


先要作一些簡單概述,windows 上執行 cmd, cmd.exe 便可以打開的這個Command Prompt,
它是 Command Line Interface(CLI),CLI 即是以文字的方式輸入指令和顯示結果的介面。
在早期全部電腦都是CLI,到了windows 3.1 才有一個比較像樣的 Graphical user interface (GUI),GUI 能以滑鼠發出指示和以圖像的方式表示結果。

不少的程式同時支援CLI, GUI,透過CLI,可以不需要滑鼠、移動滑鼠、按鍵進行操作,command prompt 的指令可以儲存成一個獨立檔案(.bat),執行檔案便可以執行儲存好的指令,令一些事情半自動化,免卻人為操作,可以節省時間,如果配合Task Scheduler,可以設成定期執行,自動化一系列事情。

備份的理由都不外乎,保險,每一次備份都是降低風險的行為。
假如將珍貴的圖片由電腦硬碟C,複製到硬碟D,當硬碟C壞了不要緊,還有硬碟D的備份。

其次是管理,在軟件工程上,經常會有備份動作,常見的術語當中涉及備份的有︰
  • Raid 0
  • Raid 1
  • Raid 5
  • Release management
  • Version control
  • Data integrity

開發軟件,最常聽到的管理方法是
DEV, UAT, PROD

當你是一人團隊/無需企業備份規格/或者老闆缺錢/
找供應商麻煩/沒有合適的軟件/沒有合適的經銷商、供應商
以下方法適合一些規模較少的備份用途,0成本

Terminology

Real-time processing

Real-Time Processing involves continuous input, process, and output of data. Hence, it processes in a short period of time.

Batch processing

Batch processing is the processing of transactions in a group or batch. No user interaction is required once batch processing is underway.

Command Line Interface (CUI)

Short for character user interface or command-line user interface, CUI is a way for users to interact with computer programs. It works by allowing the user (client) to issue commands as one or more lines of text (referred to as command lines) to a program. Good examples CUIs are MS-DOS and the Windows Command Prompt.

Graphical User Interface (GUI)

GUI is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, instead of text-based user interfaces

Archive

An archive is a collection of data moved to a repository for backup, to keep separate for compliance reasons or for moving off primary storage media. It can include a simple list of files or files organized under a directory or catalog structure (depending on how a particular program supports archiving).

Housekeep

When referring to computers, housekeeping is a term used to describe the optimization of a hard drive. Housekeeping commonly involves removing old or unused files and programs, backing up data, or running disk utilities such as a ScanDisk, Defrag, or an antivirus scan. Housekeeping keeps the computer organized, running properly, and should be performed at least once a year.


Oracle 產品的價錢都不是一般的平,不會是平民使用的東西。
打個比喻,有資本可以負擔這成本的公司,規模不會是一間辦公室,不會是一層辦公室,會是一棟大廈。

使用Oracle DB的客戶例如有政府,企業,頒授副學士或以上學歷的教育機構……
接下來完整教學,看圖識字。

Download

Visit https://www.7-zip.org/download.html
Download the 7-zip in .exe version


Installation

Execute the installer (.exe)
Confirm the install destination
Click [Install]



The loading dialog will be closed when the installation complete

Try to search "7"
You should find the 7zip application installed on your application list




My installed version is 19.0 (2019-02-21)
7zFM.exe is 7-Zip File Manager, a GUI version
7zG.exe is a CUI version

Windows Batch Script (bat)

I had written a batch script to call 7zG.exe to compress folders/files

Visit https://gist.github.com/dolphinotaku/7dd49d20f513a2d998e7ebe10c0060db


Some highlighted blue values you may need to change

If your computer do not contain D:\ (driver D), please change to C:\

Update the section ":: create folder if not exist"
the script copying the folder, includes all sub-folders, sub-files under below directory
e.g D:\xampp\htdocs\develop\demo

all copied folders/files will move to D:\temp

the script will call the 7z.exe
e.g D:\software\7-ZipPortable\App\7-Zip\7z.exe

if you installed by default location, change it to
C:\Program Files (x86)\7-Zip\7z.exe

the compressed file will be named as
site.PROD.(datetime).zip

stored at D:\Archive\ folder

Reference

7-Zip
https://www.7-zip.org/

History of the graphical user interface
https://en.wikipedia.org/wiki/History_of_the_graphical_user_interface

Housekeeping
https://www.computerhope.com/jargon/h/housekee.htm

Archive
https://techterms.com/definition/archive
https://en.wikipedia.org/wiki/Archive
https://en.wikipedia.org/wiki/Archive_file

No comments:

Post a Comment