根据子文件夹名称拆分文件夹
对于一个网站,我有很多包含相同子文件夹(图像+缩略图)的文件夹。所有这些都包含“images”文件夹,但并非所有都包含“thumbnails”文件夹。
/directory1
/folder1
/images
/thumbnails
/folder2
/images
/folder3
/images
/thumbnails
/folderA
/images
/folderB
/images
/thumbnails
我想将缩略图移到另一个目录中,因此基本上将文件夹结构分开:
/directory1
/folder1
/images
/folder2
/images
/folder3
/images
/folderA
/images
/folderB
/images
/directory2
/folder1
/thumbnails
/folder3
/thumbnails
/folderB
/thumbnails
是否有一种简单/快速的方法可以做到这一点?
所有文件夹/文件都存储在 Synology NAS 上,我可以通过 Windows PC 访问它们。
For a website I have a lot of folders containing the same subfolders (images + thumbnails). All of them contain the "images" folder, but not all of them contain "thumbnails" folder.
/directory1
/folder1
/images
/thumbnails
/folder2
/images
/folder3
/images
/thumbnails
/folderA
/images
/folderB
/images
/thumbnails
I would like to move the thumbnails into another directory, so basically separate the folderstructure:
/directory1
/folder1
/images
/folder2
/images
/folder3
/images
/folderA
/images
/folderB
/images
/directory2
/folder1
/thumbnails
/folder3
/thumbnails
/folderB
/thumbnails
Is there an easy/fast way to do this?
All folders/files are stored on a Synology NAS and I can access them via a Windows PC.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后我用一些 php 脚本解决了这个问题。使用的主要函数是:
ini_set('max_execution_time', 10800);
必要时为其提供一些运行scandir
来检查目录中的所有文件和文件夹mkdir
在别处创建新目录rename
将文件或文件夹移动到新目录起初我担心
rename
功能会复制文件/文件夹并删除之后再处理旧的,这会花费很多时间。但事实并非如此,它移动文件/文件夹并且运行速度实际上非常快。In the end I resolved it with a little php-script. The main functions used are:
ini_set('max_execution_time', 10800);
to give it some to run if necessaryscandir
to check all files and folders within a directorymkdir
to create a new directory elsewhererename
to move the file or folder to the new directoryAt first I was concerned that the
rename
function would copy the files/folders and delete the old ones afterwards, which would take a lot of time. But this is not the case, it moves the files/folders and it ran actually very fast.