如何查找具有特定名称的最新文件?(How to find newest files with a certain name?)
假设我在子目录中有一个包含许多同名文件的目录(例如,在为多篇学术论文保留BibTeX文件时出现)。
查找具有给定名称的文件的最新版本的最佳方法是什么?
我想出了以下命令
find . -name "someFile" -exec ls -alF {} \;
它列出了所有名为
someFile
的文件及其日期,但不会将它们从旧到新排序。请注意,此处不能使用
ls
的-t
选项,因为它是针对每个文件单独运行的。Suppose I have a directory with many files of the same name in subdirectories (for example, comes up when keeping BibTeX files for multiple academic papers).
What's the best way to find the newest version of a file with a given name?
I've come up with the following command
find . -name "someFile" -exec ls -alF {} \;
which lists all the files named
someFile
along with their dates, but does not sort them from old to new.Note that the
-t
option tols
can't be used here because it is being run separately for each file.
原文:https://stackoverflow.com/questions/28862590
最满意答案
分号是在这里,如果你包括这个脚本只是在一些“坏”脚本后,没有正确关闭其最后一行与分号。 在这种情况下,两个脚本可能会被组合并导致无效的代码。 例如,如果您将多个脚本合并到单个响应中。
()结束执行该函数。 这是创建一个关闭。 私有变量和方法可以在此函数的范围内声明,无法从脚本外部访问。
The semi-colon is there in case you include this script just after some 'bad' script that doesn't properly close off its last line with a semi-colon. In this case it's possible the two scripts would be combined and result in invalid code. For example if you are merging multiple script into a single response.
The () at the end is executing the function. This is creating a closure. Private variables and methods can be declared within the scope of this function that cannot be accessed from outside the script.
相关问答
更多-
它是为了防止任何先前的代码作为函数的参数执行代码。 即 mybrokenfunction = function(){ } //no semicolon here (function(g){ })(this); 将以您的匿名函数作为参数执行mybrokenfunction: mybrokenfunction = function(){}(function(g){})(this); 如果你可以保证在你的函数之前不会有一个没有终止的(不是分号)函数,你可以省略开始的分号,但是你不能,所以把这个额外的分号 ...
-
分号是在这里,如果你包括这个脚本只是在一些“坏”脚本后,没有正确关闭其最后一行与分号。 在这种情况下,两个脚本可能会被组合并导致无效的代码。 例如,如果您将多个脚本合并到单个响应中。 ()结束执行该函数。 这是创建一个关闭。 私有变量和方法可以在此函数的范围内声明,无法从脚本外部访问。 The semi-colon is there in case you include this script just after some 'bad' script that doesn't properly close ...
-
双重否定(!!)在javascript - 目的是什么?(Double negation (!!) in javascript - what is the purpose? [duplicate])[2021-06-28]
它转换为布尔值。 第一个! 否定一次,转换像这样的值: undefined为true null为true +0为true -0为true '' true NaN为true false到true 所有其他表达式为false 然后另一个! 再次否定它 一个简洁的转换为布尔值,完全相当于ToBoolean,因为! 被定义为它的否定 。 这里不必要,因为它只用作条件运算符的条件,这将以相同的方式确定真实性。 It casts to boolean. The first ! negates it once, conv ... -
:input是一个jQuery扩展,而input是一个CSS选择器。 textarea , button和select元素将被前者匹配,而不是后者。 后者更快,所以使用它为您的具体radio示例。 使用:input当您想要“所有表单元素”时:input ,即使它们不是严格的标签。 即使在这种情况下,建议首先使用标准CSS选择器,然后在该集合上使用.filter(':input') 。 因为:input是一个jQuery扩展,而不是CSS规范的一部分,使用:input的查询不能利用本机DOM q ...
-
在SQL Server中,何时应该使用GO,何时应该使用分号?(In SQL Server, when should you use GO and when should you use semi-colon ;?)[2022-02-02]
GO只涉及SSMS - 它不是实际的Transact SQL,它只是告诉SSMS按顺序在各个批次之间的每个GO之间发送SQL语句。 的; 是一个SQL语句分隔符,但在大多数情况下,引擎可以解释您的语句被分解的位置。 主要例外,地点在哪里; 最常用的是在普通表表达式之前。 GO only relates to SSMS - it isn't actual Transact SQL, it just tells SSMS to send the SQL statements between each GO in ... -
这意味着for循环的初始化器部分没有声明 同样,如果你想跳过for循环的增量部分,它看起来就像 for( ; nCount > 0; ){ // some code } // which is like while loop 从JLS开始,这是for循环的格式 BasicForStatement: for ( ForInitopt ; Expressionopt ; ForUpdateopt ) Statement 你可以看到所有3个都是可选的 that means there is no ...
-
通过查看分号,可以知道一个单元格的数据已经完成,现在它必须开始在下一个单元格中填充数据。 通过使用分号,您还可以仅使用一个out.write()语句填充多个单元格中的数据,即out.write("somedata;someotherdata;"); 。 这是语言之美。 By seeing a semicolon it gets to know that one cell's data is completed and now it has to begin filling data in the next ...
-
半结肠失踪的恐怖(semi colon missing eror)[2021-11-19]
正如Sybren的评论所述,您应该使用参数进行查询。 或者你也可以使用String.format()来使这看起来更好。 对于该问题,搜索prin_serial_txt.getText()并在Query字符串中进行正确的连接。 As said in the comment by Sybren, you should use parameters for your query. Or you can also use String.format() to make this look better. For t ... -
因为; 只是一个空语句,换句话说就是空语句 。 这通常没用,但完全有效。 这在循环中用于重复执行某些操作,但不希望添加循环体。如下例所示: for ( i = 0; i < 10; line[i++] = 0 ) ; 但是,在你的情况下,第一个分号是语句的结尾,第二个是空语句。它是无用的,编译器将忽略它。 Because ; is just an empty statement in other words null statement. It's usually useless but complet ...
-
在JavaScript中使用多个分号是否有效?(Does using more than one semi-colon in JavaScript have any effect?)[2021-09-16]
第二个分号将被解释为空语句 [spec] 。 它没有任何效果。 我相信引擎会忽略它,但这实际上取决于引擎。 The second semicolon would be interpreted as empty statement [spec]. It does not have any effect. I would believe that engines just ignore it, but that really depends on the engine.