{"id":7365,"date":"2004-03-23T01:43:22","date_gmt":"2004-03-22T23:43:22","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/2004\/03\/23\/temporary-backup-of-a-few-files\/"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T22:00:00","slug":"temporary-backup-of-a-few-files","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2004\/03\/23\/temporary-backup-of-a-few-files\/","title":{"rendered":"Temporary backup of a few files"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>Now, calm down, we are not talking about tar(1) or cpio(1) backups. Sometimes, there is a need to make a temporary copy of a few files and then copy them back to original filenames. Let&#8217;s say you have a directory with few config files and you want to copy each config file to filename.orig, and then, later, restore it to the original name. Here is how you can do it&#8230;<!--more--><b>Backup<\/b><\/p>\n<div class=\"asis\"><code><br \/>\n<br \/>\n#!\/bin\/bash<\/p>\n<p># Repeat for all .conf files... (leave just * if you want all files)<br \/>\n<br \/>\nfor CONFIG in *.conf<br \/>\n<br \/>\ndo<br \/>\n<br \/>\n        # Backup<br \/>\n<br \/>\n\tcp $CONFIG $CONFIG.orig<br \/>\n<br \/>\ndone<br \/>\n<br \/>\n<\/code><br \/>\n\n<\/div>\n<p><b>Restore<\/b><\/p>\n<div class=\"asis\"><code><br \/>\n<br \/>\n#!\/bin\/bash<br \/>\n<br \/>\n# Repeat for all .orig files...<br \/>\n<br \/>\nfor CONFIG in *.orig<br \/>\n<br \/>\ndo<br \/>\n<br \/>\n        # Restore...<br \/>\n<br \/>\n\t# Note #1: these are single BACK quotes<br \/>\n<br \/>\n\t# Note #2: use -f optin for cp if you want to overwrite originals<br \/>\n<br \/>\n\tcp $CONFIG `basename $CONFIG .orig`<br \/>\n<br \/>\ndone<br \/>\n<br \/>\n<\/code><br \/>\n\n<\/div>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>Now, calm down, we are not talking about tar(1) or cpio(1) backups. Sometimes, there is a need to make a temporary copy of a few files and then copy them back to original filenames. Let&#8217;s say you have a directory with few config files and you want to copy each config file to filename.orig, and &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2004\/03\/23\/temporary-backup-of-a-few-files\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Temporary backup of a few files<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_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},"_links_to":"","_links_to_target":""},"categories":[1,62],"tags":[],"keyring_services":[],"class_list":["post-7365","post","type-post","status-publish","format-standard","hentry","category-general","category-technology"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":7482,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/05\/04\/bofh-clan-config-files\/","url_meta":{"origin":7365,"position":0},"title":"BOFH clan config files","author":"Leonid Mamchenkov","date":"May 4, 2004","format":false,"excerpt":"I'll regularly update this post with newest copies of config files for Quake III OSP from members of my clan - BOFH. Current members [bofh]tvset [bofh]shadow Ex\/Non-active members [bofh]mokh (you'll also need mokh_timers.zip) [bofh]prog","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27408,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/03\/11\/validating-json-against-schema-in-php\/","url_meta":{"origin":7365,"position":1},"title":"Validating JSON against schema in PHP","author":"Leonid Mamchenkov","date":"March 11, 2017","format":false,"excerpt":"GitHub was rather slow yesterday, which affected the speed of installing composer dependencies (since most of them are hosted on GitHub anyway). \u00a0Staring at a slowly scrolling list of installed dependencies, I noticed something interesting. Of course, I've heard of the seld\/jsonlint before. \u00a0It's a port of zaach\/jsonlint JavaScript tool\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10155,"url":"https:\/\/mamchenkov.net\/wordpress\/2006\/05\/31\/another-downtime\/","url_meta":{"origin":7365,"position":2},"title":"Another downtime","author":"Leonid Mamchenkov","date":"May 31, 2006","format":false,"excerpt":"I begin to hate this hard disk. It got stuck once again, causing a several hour downtime. When it came back, the filesystem was partially corrupted. I fixed it. Then I realized that while fixing it, I got rid of a few files. Random config and data files disappeared. It\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":16527,"url":"https:\/\/mamchenkov.net\/wordpress\/2012\/07\/20\/wp-config-php-and-standalone-scripts\/","url_meta":{"origin":7365,"position":3},"title":"wp-config.php and standalone scripts","author":"Leonid Mamchenkov","date":"July 20, 2012","format":false,"excerpt":"WordPress plugin architecture is great and it provides developers with a lot of flexibility. \u00a0But once in a while one needs to write a standalone script that should use some of WordPress settings. \u00a0For example, a script that would have the same database credentials as a WordPress instance. \u00a0This sounds\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":24736,"url":"https:\/\/mamchenkov.net\/wordpress\/2015\/09\/14\/five-linux-ready-cost-effective-server-control-panels\/","url_meta":{"origin":7365,"position":4},"title":"Five Linux-Ready, Cost-Effective Server Control Panels","author":"Leonid Mamchenkov","date":"September 14, 2015","format":false,"excerpt":"\"Five Linux-Ready, Cost-Effective Server Control Panels\" reviews 5 some alternatives to cPanel, which, they say, is rather expensive. \u00a0My beef with cPanel is not the price, but the technical merit. \u00a0Even though I love the fact that it is written in Perl, I don't agree with its \"let me handle\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"webuzo","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2015\/09\/jack-webuzo-500x313.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":7260,"url":"https:\/\/mamchenkov.net\/wordpress\/2003\/10\/11\/2003-10-11\/","url_meta":{"origin":7365,"position":5},"title":"2003-10-11","author":"Leonid Mamchenkov","date":"October 11, 2003","format":false,"excerpt":"Went to the movies to see \"Pirates of the Caribbean: The Curse of the Black Pearl\". Nice movie. Lots of ugly pirates, treasures, fights, and generally anything else one would expect from the pirate movie. It's actually surprising how few movies there are about pirates. Hopefully, the tremendeous progress of\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/7365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=7365"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/7365\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=7365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=7365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=7365"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=7365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}