Menu

execute seeddms-importfs question?

2024-08-15
2024-08-15
  • Chien Yuchuan

    Chien Yuchuan - 2024-08-15

    Hi everyone,
    I'd likd to import NAS folder to SeedDMS. But when I run as following script under terminal, and it still import the excluded specific folders and files.

    SEEDDMS_HOME=/var/www/html/dms/seeddms
    ${SEEDDMS_HOME}/utils/seeddms-importfs --user=008135 --basefolder --foldermtime --filemtime --exclude='INSTALLFILE,.com,.exe,.~*,.dll' -e UTF-8 -d /mnt/nas/myfolder -F 1 > $HOME/importfs_1130814-3.log 2>&1 &
    

    I review utils/importfs.php, and found that it seems '--exclude' option didn't use in the import_folder() function.Is any solution to fulfill exclude option? or is my typing error?

    My system environment is as followings:
    OS: Ubuntu 22.04
    SeedDMS: 6.0.28
    php version: 8.2.22
    Postgresql: 16.4

     
  • Uwe Steinmann

    Uwe Steinmann - 2024-08-15

    --exclude is for excluding single files. You need to pass --exclude for each file you want to exclude.

    --exlude=INSTALLFILE --exclude='anotherfile'

    It does not understand wildcards

     
    • Chien Yuchuan

      Chien Yuchuan - 2024-08-15

      Thanks for your reply.
      I've try this method and retype the command as bellowings:

      SEEDDMS_HOME=/var/www/html/dms/seeddms
      ${SEEDDMS_HOME}/utils/seeddms-importfs --user=008135 --basefolder --foldermtime --filemtime --exclude='.exe' --exclude='測試目錄' -e UTF-8 -d /mnt/nas/myfolder -F 1 > $HOME/importfs_1130814-3.log 2>&1 &
      

      But it still didn't exclude all '.exe' file and '測試目錄' directory.
      When I see 'utils/importfs.php' code, it looks like didn't judge '--exclude' options. It only exclude '.' , '..' , and '.svn' . Bellowings are import_folder() function part code:

      ...
      $excludefiles = array('.', '..');
      if(isset($options['exclude'])) {
          if(is_array($options['exclude']))
              $excludefiles = array_merge($excludefiles, $options['exclude']);
          else
              $excludefiles[] = $options['exclude'];
      } else {
          $excludefiles[] = '.svn';
          $excludefiles[] = '.gitignore';
      }
      ...
      function import_folder($dirname, $folder, $setfiledate, $setfolderdate, $metadata) { /* {{{ */
          global $user, $doccount, $foldercount;
      
          $d = dir($dirname);
          $sequence = 1;
          while(false !== ($entry = $d->read())) {
              $path = $dirname.'/'.$entry;
              if($entry != '.' && $entry != '..' && $entry != '.svn') {
                  if(is_file($path)) {
                  ,,,
      
       
  • Uwe Steinmann

    Uwe Steinmann - 2024-08-15

    --exclude='.exe' excludes a file named '.exe' but not a file named e.g. 'test.exe'
    the exclude parameter sets a name not an extension. .svn and .gitignore are file/folder names.

     
    • Chien Yuchuan

      Chien Yuchuan - 2024-08-15

      Thanks a lot, I know --exclude option should be follow file /folder name.
      But -exclude='測試目錄' didn't work. Did anyone know how to trace or find out where's going wrong?

       
  • Uwe Steinmann

    Uwe Steinmann - 2024-08-15

    I checked the code of importfs.php again and realized that --exclude isn't used at all. I'll see if I can fix that, but it will probably take some time.

     
  • Uwe Steinmann

    Uwe Steinmann - 2024-08-15

    Quick hack. Replace that line

    if($entry != '.' && $entry != '..' && $entry != '.svn') {

    with

    if(!in_array($entry, $excludefiles)) {

     
    • Chien Yuchuan

      Chien Yuchuan - 2024-08-15

      It works, thanks a lot.

       

Log in to post a comment.