fruid 24 Posted November 23, 2020 it's weird, cause it works for the first of the six folders, but fails at the second one, so I doubt it's a path issue. I'll investigate. Share this post Link to post Share on other sites
fruid 24 Posted November 23, 2020 Don't know why but It now adds every image twice, very strange. In the error that is listed it says site/assets/cache/AdminActions/4105/.DS_Store but that file is nowhere, even when showing hidden files. It would make sense if that was the issue. I know this is not module related but still worth mentioning. Here's my code again… $newpages = $pages->get("title=2020/05")->children("template=article, sort=id"); foreach ($newpages as $np) : $np->of(false); $options = array( 'sourceFolder' => '/path/to/site/assets/cache/AdminActions/'.$np->id.'/', 'field' => $fields->get('images')->id, 'destinationPage' => $np->id, 'deleteFolder' => 0 ); $modules->get("ProcessAdminActions")->FtpFilesToPage($options); $np->of(true); endforeach; Thanks again for help! Share this post Link to post Share on other sites
adrian 11,936 Posted November 24, 2020 If it's finding a .DS_Store file, then it muse be there. You could add an exception to exclude files starting with a dot if you want though. I still don't know what that has to do with each image being added twice though. Share this post Link to post Share on other sites
fruid 24 Posted November 24, 2020 the .DS_Store was the issue, Tracy Debugger was even clearer about that. But since I couldn't see it on the ftp server, I re-created the folder in the cache folder, moved the images there and deleted the old one. That worked! no errors anymore. As for the double import of the images, the issue was the following line wrong: 'destinationPage' => $np->id, correct: 'destinationPage' => "$np->id", Anyway, it works now, thanks! 1 hour ago, adrian said: You could add an exception to exclude files starting with a dot How would I do that? Share this post Link to post Share on other sites
adrian 11,936 Posted November 24, 2020 10 minutes ago, fruid said: How would I do that? I'm going to make you google that 🙂 Remember that DirectoryIterator's skip_dots only detects . and .. and not hidden files that start with a dot, so you need to use some kind of substring or regex to detect if the filename starts with a dot and implement that in the foreach in the execute method. Share this post Link to post Share on other sites