<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent posts to Auto backup with full path and timestamp</title><link>https://sourceforge.net/p/npppythonscript/discussion/1199074/thread/ce05950735/</link><description>Recent posts to Auto backup with full path and timestamp</description><atom:link href="https://sourceforge.net/p/npppythonscript/discussion/1199074/thread/ce05950735/feed.rss" rel="self"/><language>en</language><lastBuildDate>Thu, 30 Sep 2021 00:42:32 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/npppythonscript/discussion/1199074/thread/ce05950735/feed.rss" rel="self" type="application/rss+xml"/><item><title>Auto backup with full path and timestamp</title><link>https://sourceforge.net/p/npppythonscript/discussion/1199074/thread/ce05950735/?limit=100#3e22</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;This is a simple Python script that backup edited file before it's being overwritten on save.&lt;br/&gt;
It recreates a directory structure of original file in the backup folder and appends modification date of the original file to the end of filename (not date of the backup, file modification date).&lt;br/&gt;
i.e. file &lt;code&gt;C:\blah\mycode.js&lt;/code&gt; will be backed up as &lt;code&gt;D:\Backup\Notepad++\C\blah\mycode.js_20210928_221824.js&lt;/code&gt;&lt;br/&gt;
Because it copies file before NPP saves new data into it, you always will have a copy of the original file.&lt;/p&gt;
&lt;p&gt;Required &lt;a class="" href="https://github.com/bruderstein/PythonScript" rel="nofollow"&gt;PythonScript&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Save this script as &lt;code&gt;autobackup.py&lt;/code&gt; into the same directory where &lt;code&gt;startup.py&lt;/code&gt; is (in portable NPP it's in Notepad++\plugins\PythonScript\scripts) and in Python Script configuration window set "Initialization" dropdown to "ATSTARTUP"&lt;/p&gt;
&lt;p&gt;Change to your desired backup directory&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;backup_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'D:\\Backup\\Notepad++\\'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;  
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Than in &lt;strong&gt;startup&lt;/strong&gt;.&lt;strong&gt;py&lt;/strong&gt; at the bottom add this line:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;autobackup&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">V@no</dc:creator><pubDate>Thu, 30 Sep 2021 00:42:32 -0000</pubDate><guid>https://sourceforge.netac7a1a2501f86ec30a592ad6a1eb5821e3e01a8c</guid></item></channel></rss>