问题标签 [gnu-findutils]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
5 回答
32791 浏览

git-bash - 在 Git Bash 终端中查找文件

我目前正在使用Git Bash导航文件目录和编辑文件。我想知道是否有命令可以搜索当前目录及其中的所有目录以查找文件名。

0 投票
1 回答
1093 浏览

regex - How to find files containing newlines in their names

There is so much told about correct handling of file names which contain weird symbols like newlines. I thought using IFS set to newline would solve the issue in general except obviously for the case if one has a name with newline in it. So as a means of defense script could check at first whether a subtree has at least one file with newline and stop with a message to fix the name first. Surprisingly I couldn't make find doing that with -regex match. Only way successful was a rather ugly

But for example find . -regex ".*\n.*" does not work. Emacs regex should allow escape characters like \n, shouldn't it ? Interestingly that it matches another file with character n in the name. Experimented with different -regextypes only to find that types awk sed posix-extended and some more would match file with a newline (let's say a\nxxx) but in addition they will match files with character n as well. Weird. On other hand GNU find documentation does not tell anything about support of escaped characters like \n. Are they really not supported so we can't use \t \n \r \a and similar in find regexps ?

0 投票
2 回答
526 浏览

macos - Ubuntu 上的 findutils 4.4.x 不允许我指定 `depth` 选项

任务:列出目录本身的所有直接后代。

在 BSD (Mac OS) 上find . -type d -depth 1有效。

这是 Ubuntu 12.04(GNU findutils 4.4.2)的输出:

好的,下次试试:

嗯,好吧,也许它想要...

显然不是,wtf,它应该需要......

不,这很明显。所以让我们尝试作为最后的手段......

耶,成功!但是,呃,为什么……?

而且,作为一个额外的问题,为什么比BSD / OSX-mindepth 1 -maxdepth 1快得多?-depth 1

0 投票
2 回答
81 浏览

php - 使用 shell 命令更改 PHP 标签

我的问题是:我尝试使用以下命令更改多个脚本中的所有标签( <?to ):<php?

问题是,如果我有这样的标签会<?echo'Ble bla..';忽略它并且不会改变。我建议做什么?

0 投票
1 回答
898 浏览

linux - Unix,在多个文件中搜索字符串。(区分大小写,如果字符串在字符串中则接受)

我一直在使用这个命令:

在多个文件中查找字符串,但我想知道如何在多个文件中找到一个字符串,区分大小写,即使该字符串在其他字符串中。

例如:

我在找:编码器

  • 如果文件包含:abcdEncoder- 应该出现
  • 如果文件包含:abcdencoder— 不应出现
  • 如果文件包含:encoderEncoder- 应该出现

也许问题是重复的,但我没有找到它!

0 投票
1 回答
102 浏览

windows - find / sed 查找文件并替换子字符串

我正在尝试在 Windows 中使用 findutil / sed / grep 在所有驱动器中查找特定文件,在该文件中查找子字符串并将其替换为新的子字符串。

根据我的研究,我必须一次执行一个驱动器,然后 cd 到下一个驱动器并再次运行。我还得到了“exec”的缺失参数。

谁能帮我解决这个问题?

谢谢

0 投票
1 回答
186 浏览

windows - 重命名具有非常大目录结构的空间文件

我已经通读并尝试了许多关于如何在嵌套目录结构中重命名带有空格的文件的答案。但是,它们似乎不适用于我的情况。他们都是段错误。

在 32,768 个目录的目录结构中,我只有 1,000,000 个文件。这也在 Windows (Server 2008 R2) 上,我正在运行 MINGW32,给我 Bash 3.1。

这些目录位于类似 00/00/file1 01/00/file2 的结构中,其中每个子目录“系列”从 00 到 zz 不等。我相信目录结构只有两层深,但我可能是错的。从 Windows 资源管理器的“属性”生成文件计数大约需要 45 分钟。

我认为此处发布的答案存在段错误,因为它们的内存构建或遍历这些目录的内存不足。这是我在此处发布之前的最后一次尝试:

我最后一次尝试尝试至少进入第一级子目录,然后使用有关该主题的另一篇文章中的此解决方案:

您可以在哪里看到我的版本只是嵌入在外部查找循环中的其他帖子的答案。但是,这也是段错误。我想尝试一下,因为在一个目录级别工作时尝试上述解决方案。

0 投票
2 回答
150 浏览

linux - 在 Bash 脚本中使用 find 命令并排除子目录

我写了一些应该在父目录中找到目录的函数,但问题是它需要很长时间,可能它也在子目录中搜索。这是我的代码:

我确定我要查找的目录位于/opt/SwDrop/Repository/其下且不能位于子目录中。知道如何解决吗?

0 投票
3 回答
6546 浏览

unix - Unix find -mtime {负值或正值}

做什么find -mtime -4find -mtime +4做什么?我无法理解手册页中给出的示例。

0 投票
1 回答
10982 浏览

linux - 按大小查找文件更多 MIN 和更少 MAX

我如何使用 linux find 命令搜索更多 MIN 和更少 MAX 的文件

我尝试使用以下命令:

但它不起作用