{"id":561,"date":"2009-01-01T17:59:22","date_gmt":"2009-01-01T16:59:22","guid":{"rendered":"http:\/\/www.palmerini.net\/blog\/?p=561"},"modified":"2009-09-03T18:04:10","modified_gmt":"2009-09-03T17:04:10","slug":"a-simple-backup-script-with-differente-filename-each-time","status":"publish","type":"post","link":"https:\/\/palmerini.net\/blog\/a-simple-backup-script-with-differente-filename-each-time\/","title":{"rendered":"A linux script that make a backup of the folder with a different filename each time"},"content":{"rendered":"<p>A simple script to backup the entire directory and subfolders execpt\u00a0 files and path that contain &#8220;data&#8221;\u00a0 in the string.<\/p>\n<p>Each backup have a unique filenames with the date in it.<\/p>\n<pre>#!\/bin\/bash\r\n# Loris Palmerini 2009 - copyright http:\/\/www.mozilla.org\/MPL\/MPL-1.1.html\r\n# a simple script to backup the entire didirectory and subfolder\r\n# execpt the filename and path that contain \"data\"\r\n# each backup have a unique filenames with the date<\/pre>\n<pre># prefix of the filename or beggining part\r\nprefix=bck<\/pre>\n<pre># the \"date\" of today in form of YYmmDDhhMMss\r\ndata=$(date +%Y%m%d%H%M%S)\u00a0 # See date command<\/pre>\n<pre># we add the \".tgz\" suffix beacouse we will use tar -cvz\r\nfilename=$prefix$data\".tgz\"\r\n# uncomment the next to print the filename\r\n#echo \"Backup file filename = $filename\"<\/pre>\n<pre># list the file of the directory 1 per line and print only\r\n#lines without \"data\" in the name of file or path\r\n# You can remove grep command to backup all\r\nls -1 | grep -v \"data\" &gt; filelist<\/pre>\n<pre># creating the backup with the file listed in filenames\r\n# as it print backupd files, remove the \"v\" in -cvzf to make it silenced\r\ntar --files-from=filelist -cvzf $filename<\/pre>\n<pre># uncomment the next if You want\u00a0 to close the shell\r\n#exit 0<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A simple script to backup the entire directory and subfolders execpt\u00a0 files and path that contain &#8220;data&#8221;\u00a0 in the string. Each backup have a unique filenames with the date in it. #!\/bin\/bash # Loris Palmerini 2009 &#8211; copyright http:\/\/www.mozilla.org\/MPL\/MPL-1.1.html # a simple script to backup the entire didirectory and subfolder # execpt the filename and [&hellip;]<\/p>\n","protected":false},"author":292,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[9],"tags":[],"class_list":["post-561","post","type-post","status-publish","format-standard","hentry","category-informatica","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"builder_content":"","_links":{"self":[{"href":"https:\/\/palmerini.net\/blog\/wp-json\/wp\/v2\/posts\/561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/palmerini.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/palmerini.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/palmerini.net\/blog\/wp-json\/wp\/v2\/users\/292"}],"replies":[{"embeddable":true,"href":"https:\/\/palmerini.net\/blog\/wp-json\/wp\/v2\/comments?post=561"}],"version-history":[{"count":0,"href":"https:\/\/palmerini.net\/blog\/wp-json\/wp\/v2\/posts\/561\/revisions"}],"wp:attachment":[{"href":"https:\/\/palmerini.net\/blog\/wp-json\/wp\/v2\/media?parent=561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/palmerini.net\/blog\/wp-json\/wp\/v2\/categories?post=561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/palmerini.net\/blog\/wp-json\/wp\/v2\/tags?post=561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}