<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://forum.xfce.org/extern.php?action=feed&amp;tid=6786&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Xfce Forums / [Solved] Create date-stamped file copy with Thunar custom action]]></title>
		<link>http://forum.xfce.org/viewtopic.php?id=6786</link>
		<description><![CDATA[The most recent posts in [Solved] Create date-stamped file copy with Thunar custom action.]]></description>
		<lastBuildDate>Fri, 13 Jul 2012 15:49:10 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: [Solved] Create date-stamped file copy with Thunar custom action]]></title>
			<link>http://forum.xfce.org/viewtopic.php?pid=26940#p26940</link>
			<description><![CDATA[<p>thanks gnome_refugee<br />I&#039;ve found out that cp %n %n_1 does all I need because I don&#039;t need date-time stamp in particular<br />but to copy multiple files is more tricky, i&#039;ve had no success yet</p><p>Edit: your file copy with time-stamp is a good idea, now&#160; think about it.</p>]]></description>
			<author><![CDATA[dummy@example.com (orbspider)]]></author>
			<pubDate>Fri, 13 Jul 2012 15:49:10 +0000</pubDate>
			<guid>http://forum.xfce.org/viewtopic.php?pid=26940#p26940</guid>
		</item>
		<item>
			<title><![CDATA[Re: [Solved] Create date-stamped file copy with Thunar custom action]]></title>
			<link>http://forum.xfce.org/viewtopic.php?pid=26938#p26938</link>
			<description><![CDATA[<p>Hi, orbspider.</p><p>Change the script to</p><p>#!/bin/bash<br />cp $1 ~/backups/$1_$(date +&quot;%d-%b-%Y_%H:%M:%S&quot;)</p><p>You&#039;ll now get files appearing in &#039;backups&#039; with names like</p><p>mydocument.odt_13-Jul-2012_20:28:09</p><p>Thunar will still recognise this file as an ODT and open it automatically with your default for this file type. Same with any other date-stamped file created by this method from mydocument.odt.</p><p>However, you can&#039;t use the right-click script method on the date-stamped file mydocument.odt_13-Jul-2012_20:28:09, because Thunar doesn&#039;t know what the heck a &#039;.odt_13-Jul-2012_20:28:09&#039; file is.</p><p>If you want to make a date-stamped version your working or final mydocument version, just delete the bit after &#039;.odt&#039;. You might find that&#039;s easier than deleting the stamp from mydocument_13-Jul-2012_20:28:09.odt!</p>]]></description>
			<author><![CDATA[dummy@example.com (gnome_refugee)]]></author>
			<pubDate>Fri, 13 Jul 2012 10:37:51 +0000</pubDate>
			<guid>http://forum.xfce.org/viewtopic.php?pid=26938#p26938</guid>
		</item>
		<item>
			<title><![CDATA[Re: [Solved] Create date-stamped file copy with Thunar custom action]]></title>
			<link>http://forum.xfce.org/viewtopic.php?pid=26931#p26931</link>
			<description><![CDATA[<p>but what if I&#039;d like the copied file to be &quot;mydocument_120712.odt&quot;&#160; like get the time stamp to append the doc name but inside the extension. ??&#160; </p><p>this would be tons more useful as then in backups -say there are over 100 files now- I can easily find all versions of &quot;mydocument&quot; and all of &quot;myconfig&quot; because they will be sorted alphabetically by the doc name and not by the timestamp.</p>]]></description>
			<author><![CDATA[dummy@example.com (orbspider)]]></author>
			<pubDate>Thu, 12 Jul 2012 16:44:21 +0000</pubDate>
			<guid>http://forum.xfce.org/viewtopic.php?pid=26931#p26931</guid>
		</item>
		<item>
			<title><![CDATA[Re: [Solved] Create date-stamped file copy with Thunar custom action]]></title>
			<link>http://forum.xfce.org/viewtopic.php?pid=24885#p24885</link>
			<description><![CDATA[<p>Here&#039;s a step-by-step explanation for beginners like me!</p><p>Why this custom action is useful: When I&#039;m working over several hours or days on a file (text in LibreOffice, spreadsheet in Gnumeric, image in GIMP, etc), I like to keep earlier versions as backups until work on the file is finished. In the past, I would open the file in the relevant application, think of a new name for that current version, save a copy with that name, and then start work on the file. This Thunar method has fewer steps and uses the same, easily understood naming convention for all file versions. It doesn&#039;t change the file suffix, as happens with the time-honoured &#039;save a copy as .bak&#039;, so the backups can be opened with the relevant applications from the Thunar GUI.</p><p>How to do it (please modify for your preferred file paths, etc):</p><p>1) Create a directory in your home directory called &#039;backups&#039;.<br />2) Copy this into a text editor:</p><p>#!/bin/bash<br />cp $1 ~/backups/$(date +&quot;%d-%b-%Y_%H:%M:%S&quot;)_$1</p><p>3) Save this text file as stamper.sh in your home directory.<br />4) Make it executable in the Thunar GUI by right-clicking on stamper.sh; go to Properties/Permissions and tick the Program box.<br />5) In Thunar, go to Edit/Configure custom actions...<br />6) Click the + icon at right to add a new action.<br />7) On the Basic tab, enter</p><p>Name: Make time-stamped copy<br />Description: -<br />Command: ~/stamper.sh %n</p><p>8) On the Appearance Conditions tab:<br />File pattern: put here the file suffix types you want to make time-stamped copies of, and separate them with a semicolon, e.g. *.txt;*.odt;*.gnumeric;*.png<br />Tick all the &#039;Files&#039; boxes</p><p>9) Choose OK and close the custom action dialog box.</p><p>Now when you select a file in Thunar that has a suffix you chose in step (8), e.g. &#039;Important_document.odt&#039;, and right-click, you will see the entry &#039;Make time-stamped copy&#039;. Choose this entry and a copy of the file will appear in your &#039;backups&#039; directory with the date and time as a prefix, e.g. &#039;6-Feb-2012_11:14:33_Important_document.odt&#039;.</p><p>The details of the time stamp can be changed by editing the &quot;%d-%b-%Y_%H:%M:%S&quot; part of stamper.sh. There&#039;s a list of the strftime codes on the Xfce date-time plugin page, <a href="http://goodies.xfce.org/projects/panel-plugins/xfce4-datetime-plugin" rel="nofollow">http://goodies.xfce.org/projects/panel- … ime-plugin</a>.</p>]]></description>
			<author><![CDATA[dummy@example.com (gnome_refugee)]]></author>
			<pubDate>Sun, 05 Feb 2012 21:58:44 +0000</pubDate>
			<guid>http://forum.xfce.org/viewtopic.php?pid=24885#p24885</guid>
		</item>
		<item>
			<title><![CDATA[Re: [Solved] Create date-stamped file copy with Thunar custom action]]></title>
			<link>http://forum.xfce.org/viewtopic.php?pid=24884#p24884</link>
			<description><![CDATA[<p>Yeah I first tried ~/bin/script but it doesn&#039;t work as a custom action. The full path is needed. Glad it&#039;s working now!</p>]]></description>
			<author><![CDATA[dummy@example.com (stqn)]]></author>
			<pubDate>Sun, 05 Feb 2012 20:28:27 +0000</pubDate>
			<guid>http://forum.xfce.org/viewtopic.php?pid=24884#p24884</guid>
		</item>
		<item>
			<title><![CDATA[Re: [Solved] Create date-stamped file copy with Thunar custom action]]></title>
			<link>http://forum.xfce.org/viewtopic.php?pid=24883#p24883</link>
			<description><![CDATA[<p>Many thanks, stqn, worked perfectly. No quotes needed on %n in the custom action command.</p><p>I&#039;d tried putting in a placeholder ($0) in the script yesterday, but couldn&#039;t get the direction to the script correct in the custom action command.</p>]]></description>
			<author><![CDATA[dummy@example.com (gnome_refugee)]]></author>
			<pubDate>Sun, 05 Feb 2012 20:04:40 +0000</pubDate>
			<guid>http://forum.xfce.org/viewtopic.php?pid=24883#p24883</guid>
		</item>
		<item>
			<title><![CDATA[Re: [Solved] Create date-stamped file copy with Thunar custom action]]></title>
			<link>http://forum.xfce.org/viewtopic.php?pid=24881#p24881</link>
			<description><![CDATA[<p>Something like this should work:</p><p>Custom action: /home/refugee/bin/backup.sh &quot;%n&quot;</p><p>backup.sh: cp $1 ~/backups/b_$(date +&quot;%d-%b-%Y_%H:%M&quot;)_$1</p><p>(Not sure if you have to put quotes around %n or not.)</p>]]></description>
			<author><![CDATA[dummy@example.com (stqn)]]></author>
			<pubDate>Sun, 05 Feb 2012 14:15:48 +0000</pubDate>
			<guid>http://forum.xfce.org/viewtopic.php?pid=24881#p24881</guid>
		</item>
		<item>
			<title><![CDATA[Re: [Solved] Create date-stamped file copy with Thunar custom action]]></title>
			<link>http://forum.xfce.org/viewtopic.php?pid=24878#p24878</link>
			<description><![CDATA[<p>Whoops. Of course that script won&#039;t work, &#039;%n&#039; is meaningless outside the custom action context.</p><p>Still puzzled that I can prefix the copy&#039;s filename with any string I like, but not with the unrelated command output from date.</p>]]></description>
			<author><![CDATA[dummy@example.com (gnome_refugee)]]></author>
			<pubDate>Sun, 05 Feb 2012 09:37:41 +0000</pubDate>
			<guid>http://forum.xfce.org/viewtopic.php?pid=24878#p24878</guid>
		</item>
		<item>
			<title><![CDATA[Re: [Solved] Create date-stamped file copy with Thunar custom action]]></title>
			<link>http://forum.xfce.org/viewtopic.php?pid=24873#p24873</link>
			<description><![CDATA[<p>Hi, stqn. Many thanks for your quick reply.</p><p>Each of the scripts I&#039;ve tried has been executable. In the &#039;command&#039; box in the custom action dialogue, I&#039;ve tried entering the path to the script, and also &#039;xfce4-terminal&#039; followed by the path to the script. Neither works. The script is just the command I posted:</p><p>#!/bin/bash<br />cp %n ~/backups/b_$(date +&quot;%d-%b-%Y_%H:%M&quot;)_%n</p><p>I suspect the problem might be the expression &#039;%n&#039;. Obviously Thunar understands it, and &#039;cp&#039; understands it when it&#039;s included in a custom action command, but maybe not when it&#039;s used in a simple bash script? (Although stat does.)</p>]]></description>
			<author><![CDATA[dummy@example.com (gnome_refugee)]]></author>
			<pubDate>Sun, 05 Feb 2012 02:14:40 +0000</pubDate>
			<guid>http://forum.xfce.org/viewtopic.php?pid=24873#p24873</guid>
		</item>
		<item>
			<title><![CDATA[Re: [Solved] Create date-stamped file copy with Thunar custom action]]></title>
			<link>http://forum.xfce.org/viewtopic.php?pid=24871#p24871</link>
			<description><![CDATA[<p>There&#039;s nothing special to do to point your custom action to a bash script... The script just has to be executable.</p>]]></description>
			<author><![CDATA[dummy@example.com (stqn)]]></author>
			<pubDate>Sun, 05 Feb 2012 01:13:02 +0000</pubDate>
			<guid>http://forum.xfce.org/viewtopic.php?pid=24871#p24871</guid>
		</item>
		<item>
			<title><![CDATA[[Solved] Create date-stamped file copy with Thunar custom action]]></title>
			<link>http://forum.xfce.org/viewtopic.php?pid=24868#p24868</link>
			<description><![CDATA[<p>I haven&#039;t posted here for a while, but I&#039;d be grateful for help with this one. Running Xfce 4.6.2 and Thunar 1.0.2 in Debian Squeeze.</p><p>I can back up a selected file to a &#039;backups&#039; directory with the Thunar custom action<br />cp %n ~/backups/%n</p><p>I can modify the filename of the copy to have &#039;b_&#039; in front with<br />cp %n ~/backups/b_%n</p><p>However, custom actions does not let me add the output of the date command to the file name with<br />cp %n ~/backups/b_$(date +&quot;%d-%b-%Y_%H:%M&quot;)_%n</p><p>This action just creates b_[filename].</p><p>I&#039;ve tried a couple of ways to use a bash script in custom actions but haven&#039;t succeeded yet. Suggestions very welcome.</p>]]></description>
			<author><![CDATA[dummy@example.com (gnome_refugee)]]></author>
			<pubDate>Sat, 04 Feb 2012 23:58:11 +0000</pubDate>
			<guid>http://forum.xfce.org/viewtopic.php?pid=24868#p24868</guid>
		</item>
	</channel>
</rss>
