问题标签 [scandir]
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.
php - Reclusive Directory Remove not working?
I am trying to remove a directory and all of its contents with this script...
The $post is working fine and the script is not returning any errors but its just not deleting the directory. Could it have something to do with folder permissions? Do I need to activate any PHP extensions?
--EDIT--
The linked duplicate does not do what I want and I don't know how to change the code for it. I am deleting a directory on the client side so I can't use __DIR__
as that keeps the path like this /test/app and I need them to be like this \test\app also the code does not remove the folder but it does remove all of the contents. I believe that is to do with the FilesystemIterator::SKIP_DOTS
line. I need the code to remove the folder as well because when or if the user installs the app again it wont work due to the duplicate folder.
Working code:
php - PHP 使用 Scandir 和外部 URL - 未实现
我在使用 scandir 时遇到了一些问题 - 我在一个站点上运行良好,但现在我想扫描该站点上的同一目录,但来自不同的网站。
我正在使用以下代码:
我得到这个错误:
我有一个谷歌,但很少提到 - 我尝试在外部站点上启用目录列表,并且也启用了 allow_fopen_url。
我被难住了,这个有帮助吗?
file - 如何在远程服务器上使用 ssh2 区分文件和目录
我们试图仅从远程服务器移动文件并将文件目录放入我们的数据库中,因此我们需要能够区分文件和目录。我们已经成功地能够通过 SSH2 进行连接,并且能够读取和显示远程路径顶级目录中的文件和目录。但是,我们无法找到一个 php 脚本,它可以让我们找到返回的名称是目录还是文件。下面是我们尝试过的几个例子。非常感谢任何帮助,我们提前感谢您。
c - OS X:scandir() 函数的 dirent struct 属性有问题
我正在尝试制作目录的快照,就像苹果文档中描述的那样。
我想使用scandir()
功能。这是来自文档:
我不明白如何正确使用它。这是我实现快照功能的方式:
这是一个dirent struct
:
我不明白正确创建dirent struct
以及如何在scandir()
功能中正确使用它。
我从该函数中想要的只是一个数组,稍后我将它与另一个快照进行比较时可以使用它。
c - 如何为scandir()实现自定义比较()
我一直在阅读 scandir()、alphasort() 的手册页,显然已经把它们都塞满了。但仍然无法弄清楚如何实现自定义比较功能。
这是我的代码:
}
很容易看出,我试图按字母顺序对文件名进行排序,而不考虑隐藏文件和普通文件(前导“.”)。
但是计算机总是会做你告诉它的事情,而不是你想要它做的事情。
c - 如何在c中正确使用scandir()?
我正在尝试将文件列表存储在 char** 变量中。
scandir() 正确完成,但在尝试打印 char** 时出现分段错误。
这是代码:
这会在打印 2 个文件名后出现分段错误。
输出:
总计:27 个文件。
..
.jv
分段错误(核心转储)
c - 正确使用 scandir() 排序?
这是我的比较功能...
是错误:在不是结构或联合的东西中请求成员“d_name”这里有什么问题?
php - 针对 db 检查文件系统文件的一致性
我有一个 PHP 脚本,可以将文件上传到我的文件系统上的目录。同时,我将文件名存储在 MYSQL DB 的字段中。
我已经看到我的文件比数据库中的记录多。
找出并删除所有未链接到数据库记录的文件的最短方法是什么?我的想法是从目录中读取每个文件名,使用从步骤 1 获取的文件名在 db 上运行查询,以防查询返回 0 结果以删除文件。
提前感谢您的任何建议。
莱利奥
c++ - 如何在 scandir 中参数化选择函数
scandir() 函数扫描目录 dir,在每个目录条目上调用 select() 作为“int(*filter)(const struct dirent *)” 如何将模式值作为参数传递给 fnmatch(const char *pattern, const char *string, int flags) 过滤器中使用的函数?
这是我的示例代码
我的目标是能够使用 my_pattern 作为输入参数。
php - 通过 PHP 显示 Box 文件夹中的所有图像文件
我对 Box 环境完全陌生。我正在使用当前代码在网站上的 web 目录中显示所有图像,其中最新文件首先列出:
我想集成 Box API 以从我的 Box 文件夹而不是 Web 文件夹中获取文件。当前的 API 可以做到这一点吗?我尝试使用以下内容显示 Open Access 文件夹的内容:
但只接收页面上的数组值"{"shared_link":{"access":"Open"}}"
。
我已经用尽了在 Google 和 Stackoverflow 上的搜索能力,并且没有遇到试图完成此任务的线程。感谢您的任何指导/帮助。