src/bbn/file/dir.php
public static function move($orig, $dest, $st = '_v', $length = 0): bool
	{
    if ( file_exists($orig) && self::create_path(\dirname($dest)) ){
      if ( file_exists($dest) ){
        if ( $st === true ){
          self::delete($dest);
        }
        else{
          $i = 1;
          while ( $i ){
            $dir = \dirname($dest).'/';
            $file_name = bbn\str::file_ext($dest, 1);
            $file = $file_name[0].$st;
            if ( $length > 0 ){
              $len = \strlen(bbn\str::cast($i));
              if ( $len > $length ){
                return false;
              }
              $file .= str_repeat('0', $length - $len);
            }
            $file .= bbn\str::cast($i);
            if ( !empty($file_name[1]) ){
              $file .= '.'.$file_name[1];
            }
            $i++;
            if ( !file_exists($dir.$file) ){
              $dest = $dir.$file;
              $i = false;
            }
          }
        }
      }
      if ( rename($orig, $dest) ){
        return true;
      }
    }
    return false;
	}
public static function move($orig, $dest, $st = '_v', $length = 0): bool
	{
    if ( file_exists($orig) && self::create_path(\dirname($dest)) ){
      if ( file_exists($dest) ){
        if ( $st === true ){
          self::delete($dest);
        }
        else{
          $i = 1;
          while ( $i ){
            $dir = \dirname($dest).'/';
            $file_name = bbn\str::file_ext($dest, 1);
            $file = $file_name[0].$st;
            if ( $length > 0 ){
              $len = \strlen(bbn\str::cast($i));
              if ( $len > $length ){
                return false;
              }
              $file .= str_repeat('0', $length - $len);
            }
            $file .= bbn\str::cast($i);
            if ( !empty($file_name[1]) ){
              $file .= '.'.$file_name[1];
            }
            $i++;
            if ( !file_exists($dir.$file) ){
              $dest = $dir.$file;
              $i = false;
            }
          }
        }
      }
      if ( rename($orig, $dest) ){
        return true;
      }
    }
    return false;
	}
public static function move ( $ orig , $ dest , $ st = '_v' , $ length = 0 ) : bool { if ( file_exists ( $ orig ) && self :: create_path ( \ dirname ( $ dest ) ) ) { if ( file_exists ( $ dest ) ) { if ( $ st === true ) { self :: delete ( $ dest ) ; } else { $ i = 1 ; while ( $ i ) { $ dir = \ dirname ( $ dest ) . '/' ; $ file_name = bbn \ str :: file_ext ( $ dest , 1 ) ; $ file = $ file_name [ 0 ] . $ st ; if ( $ length > 0 ) { $ len = \ strlen ( bbn \ str :: cast ( $ i ) ) ; if ( $ len > $ length ) { return false ; } $ file .= str_repeat ( '0' , $ length - $ len ) ; } $ file .= bbn \ str :: cast ( $ i ) ; if ( ! empty ( $ file_name [ 1 ] ) ) { $ file .= '.' . $ file_name [ 1 ] ; } $ i ++ ; if ( ! file_exists ( $ dir . $ file ) ) { $ dest = $ dir . $ file ; $ i = false ; } } } } if ( rename ( $ orig , $ dest ) ) { return true ; } } return false ; }
Moves a file or directory to a new location

```php
\bbn\x::dump(\bbn\file\dir::move("/home/data/test/Folder/image.png","/home/data/test/Folder_test/image.png"));
\\ (string) "image.png"
\bbn\x::dump(\bbn\file\dir::move("/home/data/test/Folder/image.png","/home/data/test/Folder_test/Intro/image.png"));
\\ (string) "image.png"
\bbn\x::dump(\bbn\file\dir::move("/home/data/test/Folder","/home/data/test/Folder_test", true));
\\ (string) "Folder_test"
\bbn\x::dump(\bbn\file\dir::move("/home/data/test/Folder","/home/data/test/Folder_test", "_n", 3));
\\ (string) "Folder_test_n001"
```

@param string $orig The path of the file to move
@param string $dest The full name of the destination (including basename)
@param string | true $st If in the destination folder alredy exists a file with the same name of the file to move it will rename the file adding '_v' (default). If 'string' will change the file name with the given string. If $st=true it will overwrite the file/folder.
@param int $length The number of characters to use for the revision number; will be zerofilled
@return bool Success
Moves a file or directory to a new location