0

I've got a Thunar script with this only line: cp "$@" "$@-$TS".txt it appends a timestamp suffix and the .txt extension to the file I right-click in

Now, I want to append a timestamp prefix and also add the .txt extension, but it doesn't work: cp "$@" "$TS-$@".txt

What am I doing wrong?

mechanical_meat
  • 163,903
  • 24
  • 228
  • 223
  • This also appends a timestamp suffix to the filename: cp $1 $1_$(date +"%d-%b-%Y_%H:%M:%S").txt But, when I try to put the timestamp as a prefix, it doesn't work either: cp $1 "$(date +"%d-%b-%Y_%H:%M:%S")"_"$1".txt – oak-island-pirate Mar 11 '17 at 00:13
  • Found a very good solution here: https://forum.xfce.org/viewtopic.php?id=11482 – oak-island-pirate Mar 11 '17 at 21:12

1 Answers1

0

Well, I've found a solution. Replace geany with your favourite text editor.

#!/bin/sh
TS=$( date +%Y%m%d-%H%M%S )
cp "$@" $TS.txt
geany $TS.txt