使用find和exec命令将日期附加到文件名

时间:2019-02-14 11:20:14

标签: linux bash exec

在Linux上具有以下bash代码,在gz完成他的过程之后,如何修改它以附加日期戳?

import sys
if sys.version_info[0] < 3:
    import Tkinter as Tk
else:
    import tkinter as Tk
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import numpy as np

class Application():

    def __init__(self, master):

        self.master = master
        master.iconify

        self.entry_frame = Tk.Frame(master)
        self.entry_frame.pack(side=Tk.TOP, fill=Tk.BOTH, expand=0)

        self.m1_label = Tk.Label(self.entry_frame, text='Mouse Coordinates: ')
        self.m1_label.pack(side=Tk.LEFT)
        self.m1_entry = Tk.Entry(self.entry_frame, width=10)
        self.m1_entry.pack(side=Tk.LEFT)
        self.m1_entry.bind('<Button-1>', lambda e:self.callback(1))

        self.image_frame = Tk.Frame(master)
        self.image_frame.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
        self.image_frame.bind('<Button-1>', lambda e:self.callback(0))  # something like this

        self.fig = Figure()
        self.ax = self.fig.add_subplot(111)
        self.ax.set_aspect('equal')

        self.canvas = FigureCanvasTkAgg(self.fig, self.image_frame)
        self.canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
        self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)  

        self.widget_active = 0
        self.fig.canvas.mpl_connect('button_press_event', self.select_marker)


    def callback(self, state):
        self.widget_active = state
        print(state)

    def select_marker(self, event):
        if self.widget_active == 1:
            if event.button == 1:
                x = np.round(event.xdata,2)
                y = np.round(event.ydata,2)
                print(x,y)
                self.m1_entry.delete(0,'end')
                self.m1_entry.insert(0,(str(x)+', '+str(y)))
            else:
                pass
        if self.widget_active == 0:
            pass

root = Tk.Tk()
Application(root)
root.mainloop()

2 个答案:

答案 0 :(得分:0)

一个简单的解决方案是使用简单的for循环并执行gzip并重命名,如下所示:

@file somefile.c
@doorsdocurl <URL to DOORS document> -> this is going to be my placeholder

...
...
...


/**
* @brief somedescription
* @req{doorsdocurl: <reqID1, reqID2,...> } -> this is going to be the second custom tag
*/
void jambo()
{
}

答案 1 :(得分:0)

这可以查看您的查找结果:

help(request)

运行它:
find ./ -type f -name "nsshow*" -exec echo cp {} /tmp/{}_test \; cp ./nsshow_SANSW06_FABB /tmp/./nsshow_SANSW06_FABB_test cp ./nsshow_SANSW02_FABB /tmp/./nsshow_SANSW02_FABB_test cp ./nsshow_SANSW05_FABA /tmp/./nsshow_SANSW05_FABA_test cp ./nsshow_SANSW01_FABA /tmp/./nsshow_SANSW01_FABA_test

上面的“ for”循环很不错,非常适合高级工作:

find ./ -type f -name "nsshow*" -exec cp {} /tmp/{}_test \;