Add new files in a (sub)folder with a Job

Permalink
Hi there,

I'm trying to add new images with the Importer class, so far so good:
$fi = new Importer();
if($fv = $fi->importIncomingFile($filepath)){
   $returnFile = \Concrete\Core\File\File::getByID($fv->getFileID());
}
But because there are hundreds of images i want to put them in a subfolder (i don't want the filemanager to get flooded), in the documentation i can't find anything that's useful for me.

I made a folder called 'cars' and found out that the ID of the folder is 99. So i tried this:
$ff = new Filesystem;
$car_folder = Node::getByID(99);
$returnFile->setFileFolder($car_folder);
But the file is still in the root folder when i look in the file manager. Anyone who can point me in the right direction?

 
webvanced replied on at Permalink Reply
Fixed it, used import() instead of importIncomingFile(), and added a folder as argument:
<?php
$ff = new Filesystem;
$folder= Node::getByID(99);
$fi = new Importer();
$dir = '/random_dir/'
$filename = '123456.jpg';
if($fv = $fi->import($dir, $filename, $folder)){
    $fID = $fv->getFileID();
}
?>