/**
  * @param string $file
  */
 private function clean($file)
 {
     if (ftp_size($this->connection, $file) == -1) {
         $result = ftp_nlist($this->connection, $file);
         foreach ($result as $childFile) {
             $this->clean($childFile);
         }
         ftp_rmdir($this->connection, $file);
     } else {
         ftp_delete($this->connection, $file);
     }
 }
Example #2
1
function DeleteFile($fichierAsupprimer)
{
    global $ftp;
    // Tente d'effacer le fichier $file
    if (ftp_delete($ftp, $fichierAsupprimer)) {
        echo "{$fichierAsupprimer} effacé avec succès\n";
    } else {
        echo "Impossible d'effacer le fichier {$fichierAsupprimer}\n";
    }
    return 1;
}
Example #3
0
function DeleteUpfile($R, $d)
{
    global $g, $table;
    $UPFILES = getArrayString($R['upload']);
    foreach ($UPFILES['data'] as $_val) {
        $U = getUidData($table['s_upload'], $_val);
        if ($U['uid']) {
            if ($U['url'] == $d['comment']['ftp_urlpath']) {
                $FTP_CONNECT = ftp_connect($d['comment']['ftp_host'], $d['comment']['ftp_port']);
                $FTP_CRESULT = ftp_login($FTP_CONNECT, $d['comment']['ftp_user'], $d['comment']['ftp_pass']);
                if ($d['comment']['ftp_pasv']) {
                    ftp_pasv($FTP_CONNECT, true);
                }
                if (!$FTP_CONNECT) {
                    getLink('', '', 'FTP서버 연결에 문제가 발생했습니다.', '');
                }
                if (!$FTP_CRESULT) {
                    getLink('', '', 'FTP서버 아이디나 패스워드가 일치하지 않습니다.', '');
                }
                ftp_delete($FTP_CONNECT, $d['comment']['ftp_folder'] . $U['folder'] . '/' . $U['tmpname']);
                if ($U['type'] == 2) {
                    ftp_delete($FTP_CONNECT, $d['comment']['ftp_folder'] . $U['folder'] . '/' . $U['thumbname']);
                }
                ftp_close($FTP_CONNECT);
            } else {
                unlink($U['url'] . $U['folder'] . '/' . $U['tmpname']);
                if ($U['type'] == 2) {
                    unlink($U['url'] . $U['folder'] . '/' . $U['thumbname']);
                }
            }
            getDbDelete($table['s_upload'], 'uid=' . $U['uid']);
        }
    }
}
Example #4
0
 public function del($file)
 {
     if (!$this->connect_id) {
         return false;
     }
     return ftp_delete($this->connect_id, $file);
 }
Example #5
0
/**
* Deletes an Attachment
*/
function unlink_attach($filename, $mode = false)
{
    global $upload_dir, $config, $lang;
    $filename = basename($filename);
    if (!intval($config['allow_ftp_upload'])) {
        if ($mode == MODE_THUMBNAIL) {
            $filename = $upload_dir . '/' . THUMB_DIR . '/t_' . $filename;
        } else {
            $filename = $upload_dir . '/' . $filename;
        }
        $deleted = @unlink($filename);
    } else {
        $conn_id = attach_init_ftp($mode);
        if ($mode == MODE_THUMBNAIL) {
            $filename = 't_' . $filename;
        }
        $res = @ftp_delete($conn_id, $filename);
        if (!$res) {
            if (ATTACH_DEBUG) {
                $add = $mode == MODE_THUMBNAIL ? '/' . THUMB_DIR : '';
                message_die(GENERAL_ERROR, sprintf($lang['Ftp_error_delete'], $config['ftp_path'] . $add));
            }
            return $deleted;
        }
        @ftp_quit($conn_id);
        $deleted = true;
    }
    return $deleted;
}
Example #6
0
 /**
  * Salva o conteúdo do arquivo no servidor Oracle
  * Caso seja possível salvar o arquivo, será retornado
  * o filename completo de onde o arquivo será armazenado
  * 
  * @param Zend_Db $db
  * @return string
  */
 public function save($db = null)
 {
     if ($db == null) {
         $db = Zend_Registry::get('db.projta');
     }
     if ($this->_content instanceof ZendT_Type_Blob) {
         $sql = "\n                    declare\n                      v_blob BLOB;\n                    begin\n                       insert into tmp_blob(content) values (:content);\n                       select content into v_blob FROM tmp_blob;\n                       arquivo_pkg.write_to_disk(p_data => v_blob,\n                                                 p_file_name => :name,\n                                                 p_path_name => :path);\n                    end;                \n                ";
         @($conn = ftp_connect('192.168.1.251'));
         if (!$conn) {
             throw new ZendT_Exception(error_get_last());
         }
         @($result = ftp_login($conn, 'anonymous', 'anonymous'));
         if (!$result) {
             throw new ZendT_Exception(error_get_last());
         }
         $fileNameServer = 'pub/temp/' . $this->_name;
         @ftp_delete($conn, $fileNameServer);
         @($result = ftp_put($conn, $fileNameServer, $this->_fileName, FTP_BINARY));
         if (!$result) {
             throw new ZendT_Exception(error_get_last() . ". Name Server: {$fileNameServer} || Name Local: {$this->_fileName}");
         }
         @($result = ftp_close($conn));
     } else {
         $sql = "\n                    begin\n                    arquivo_pkg.write_to_disk(p_data => :content,\n                                              p_file_name => :name,\n                                              p_path_name => :path);\n                    end;                \n                ";
         $stmt = $db->prepare($sql);
         $stmt->bindValue(':content', $this->_content);
         $stmt->bindValue(':name', $this->_name);
         $stmt->bindValue(':path', $this->_path);
         $stmt->execute();
     }
     $filename = $this->_path . '/' . $this->_name;
     return $filename;
 }
Example #7
0
 public function FTPDelete($file)
 {
     if (!@ftp_delete($this->connection, $file)) {
         require_once 'Newstool/FTP/Exception.php';
         throw new Newstool_FTP_Exception('Could not delete the file');
     }
 }
Example #8
0
 function del_file($path)
 {
     $this->off = @ftp_delete($this->conn_id, $path);
     if (!$this->off) {
         echo "文件删除失败,请检查权限及路径是否正确!";
     }
 }
Example #9
0
 public function delete($strPath)
 {
     if (stristr($strPath, "*") === false) {
         //*** Regular FTP delete.
         try {
             @ftp_delete($this->objFTP, $strPath);
         } catch (Exception $e) {
             echo $e->getMessage();
         }
     } else {
         //*** Wildcard delete.
         $strBasePath = dirname($strPath);
         $strFileName = basename($strPath);
         //*** Get files in remote folder.
         $arrFiles = $this->nlist($strBasePath);
         if ($arrFiles !== false) {
             foreach ($arrFiles as $strFile) {
                 $strBaseFile = basename($strFile);
                 if (!$this->is_dir($strFile) && $this->hasWildcard($strFileName, $strBaseFile)) {
                     @ftp_delete($this->objFTP, $strBasePath . "/" . $strBaseFile);
                 }
             }
         }
     }
 }
Example #10
0
 function mdelete($path)
 {
     if (!$this->conn_id) {
         return false;
     }
     return @ftp_delete($this->conn_id, $path);
 }
Example #11
0
 function delete($filename)
 {
     if (!@ftp_delete($this->ftp_conn, $filename)) {
         $this->error[] = "Could not delete {$filename}";
         return false;
     }
     return true;
 }
Example #12
0
 function remove($ident)
 {
     $conn_id = ftp_connect(__FTP_SERVER__);
     $login_result = ftp_login($conn_id, __FTP_UNAME__, __FTP_PASSWD__);
     $ret = ftp_delete($conn_id, __FTP_DIR__ . "/" . $ident);
     ftp_close($conn_id);
     return $ret;
 }
Example #13
0
 protected function ftpDelete($path)
 {
     $result;
     $conn_id = ftp_connect(FTP_SERVER);
     $login_result = ftp_login($conn_id, FTP_USER_NAME, FTP_USER_PASS);
     $result = ftp_delete($conn_id, $path);
     ftp_close($conn_id);
     return $result;
 }
Example #14
0
 protected function deleteFiles($files)
 {
     foreach ($files as $file) {
         $success = ftp_delete($this->connection, $file);
         if (!$success) {
             throw new \Exception('Could not delete file from ftp: ' . $file);
         }
     }
 }
Example #15
0
function deleteimg($img)
{
    $imgd = $img;
    $conn = ftp_connect("localhost");
    ftp_login($conn, "root", "sandy");
    ftp_chdir($conn, "dj/images");
    echo ftp_delete($conn, "{$imgd}.jpg");
    ftp_close($conn);
}
Example #16
0
 static function ftp_image_delete_file($sourceFileName)
 {
     if (self::ftp_image_connect()) {
         if (@ftp_delete(ImageLib::$ftp_image_connect_id, $sourceFileName)) {
             return true;
         }
     }
     return false;
 }
Example #17
0
 public function limitbackup()
 {
     $fileList = $this->getBackupTimeList();
     $connection = $this->getConnection();
     for ($index = 0; count($fileList) > $this->limit - 1; ++$index) {
         $fileName = Vtiger_BackupZip::getDefaultFileName($fileList[$index]);
         @ftp_delete($connection, $fileName);
         unset($fileList[$index]);
     }
 }
Example #18
0
 public function delete($file)
 {
     if (ftp_size($this->connection, $file) != -1) {
         $delete = ftp_delete($this->connection, $file);
         if ($delete) {
         } else {
         }
     }
     return $this;
 }
/**
 * Recursively delete the files in a directory via FTP.
 *
 * @author      Aidan Lister <*****@*****.**>
 * @version     1.0.0
 * @link        http://aidanlister.com/2004/04/recursively-deleting-directories-via-ftp/ 
 * @param       resource $ftp_stream   The link identifier of the FTP connection
 * @param       string   $directory    The directory to delete
 */
function ftp_rmdirr($ftp_stream, $directory)
{
    // Sanity check
    if (!is_resource($ftp_stream) || get_resource_type($ftp_stream) !== 'FTP Buffer') {
        return false;
    }
    // Init
    $i = 0;
    $files = array();
    $folders = array();
    $statusnext = false;
    $currentfolder = $directory;
    // Get raw file listing
    $list = ftp_rawlist($ftp_stream, $directory, true);
    // Iterate listing
    foreach ($list as $current) {
        // An empty element means the next element will be the new folder
        if (empty($current)) {
            $statusnext = true;
            continue;
        }
        // Save the current folder
        if ($statusnext === true) {
            $currentfolder = substr($current, 0, -1);
            $statusnext = false;
            continue;
        }
        // Split the data into chunks
        $split = preg_split('[ ]', $current, 9, PREG_SPLIT_NO_EMPTY);
        $entry = $split[8];
        $isdir = $split[0][0] === 'd' ? true : false;
        // Skip pointers
        if ($entry === '.' || $entry === '..') {
            continue;
        }
        // Build the file and folder list
        if ($isdir === true) {
            $folders[] = $currentfolder . '/' . $entry;
        } else {
            $files[] = $currentfolder . '/' . $entry;
        }
    }
    // Delete all the files
    foreach ($files as $file) {
        ftp_delete($ftp_stream, $file);
    }
    // Delete all the directories
    // Reverse sort the folders so the deepest directories are unset first
    rsort($folders);
    foreach ($folders as $folder) {
        ftp_rmdir($ftp_stream, $folder);
    }
    // Delete the final folder and return its status
    return ftp_rmdir($ftp_stream, $directory);
}
 public function delete($file_path)
 {
     $result = ftp_delete($this->_connection_id, $file_path);
     if ($result) {
         return true;
     } else {
         $log = new \Kiva\Silverpop_Connector\Logger();
         $log->error("Failed to remove {$file_path} from FTP.");
         return false;
     }
 }
function ftp_rdel($handle, $path)
{
    if (@ftp_delete($handle, $path) === false) {
        if ($children = @ftp_nlist($handle, $path)) {
            foreach ($children as $p) {
                ftp_rdel($handle, $p);
            }
        }
        @ftp_rmdir($handle, $path);
    }
}
Example #22
0
 public function deleteFile($filename)
 {
     if ($this->getConnectType() === self::CONNECT_TYPE_FTP) {
         if (!ftp_delete($this->getConnection(), $filename)) {
             throw new \ErrorException('Failed to delete file');
         }
     } elseif ($this->getConnectType() === self::CONNECT_TYPE_SFTP) {
         if (!$this->getConnection()->delete($filename)) {
             throw new \ErrorException('Failed to delete file');
         }
     }
 }
Example #23
0
 public function del($file, $recursive = false)
 {
     if (!$recursive) {
         return @ftp_delete($this->stream, $file);
     }
     if (!@ftp_delete($this->stream, $file)) {
         foreach ($this->ls($file) as $item) {
             $this->del($item, $recursive);
         }
         @ftp_rmdir($this->stream, $file);
     }
 }
Example #24
0
function deleteDirUndFiles($conn_id, $pfad)
{
    $return = @ftp_chdir($conn_id, $pfad);
    $file_list = ftp_nlist($conn_id, "");
    foreach ($file_list as $file) {
        if ($file == "." || $file == "..") {
            //echo "nix";
        } else {
            $return = @ftp_delete($conn_id, $pfad . $file);
        }
    }
    $return = @ftp_rmdir($conn_id, $pfad);
}
Example #25
0
function mappa_torles($mappa, $hova, $id)
{
    if (!(ftp_rmdir($id, "{$hova}/{$mappa}") || ftp_delete($id, "{$hova}/{$mappa}"))) {
        $list = ftp_nlist($id, "{$hova}/{$mappa}");
        if (!empty($list)) {
            foreach ($list as $ezeket) {
                mappa_torles($ezeket, "", $id);
            }
        }
    }
    ftp_rmdir($id, "{$hova}/{$mappa}");
    return header("Location:{$PHP_SELF}?mit=" . urlencode($hova));
}
Example #26
0
 function delete_file($remote)
 {
     global $strErrFtpNoDel;
     @ftp_pasv($this->ftpc, true);
     $delete = @ftp_delete($this->ftpc, $remote);
     if (!$delete) {
         $this->error = $strErrFtpNoDel;
         return false;
     } else {
         //ftp_chmod($this->ftpc, 0777, $remote); (php5 only)
         return true;
     }
 }
Example #27
0
function ftp_rmfiles($ftp_stream, $directory, $nodel = "", $nodelpict = "")
{
    if (!is_resource($ftp_stream) || get_resource_type($ftp_stream) !== 'FTP Buffer') {
        return false;
    }
    ftp_pasv($ftp_stream, true);
    $i = 0;
    $files = array();
    $statusnext = false;
    $statusprev = false;
    $currentfolder = $directory;
    $list = ftp_rawlist($ftp_stream, $directory, true);
    foreach ($list as $current) {
        if (empty($current)) {
            if ($statusprev == true) {
                $statusprev = false;
                continue;
            }
            $statusnext = true;
            continue;
        }
        if ($statusnext === true) {
            $currentfolder = substr($current, 0, -1);
            $statusnext = false;
            $statusprev = true;
            continue;
        }
        $split = preg_split('[ ]', $current, 9, PREG_SPLIT_NO_EMPTY);
        $entry = $split[8];
        $isdir = $split[0][0] === 'd' ? true : false;
        if ($entry === '.' || $entry === '..') {
            continue;
        }
        if ($isdir !== true) {
            $files[] = $currentfolder . '/' . $entry;
        }
    }
    foreach ($files as $file) {
        //HUOM: Kuvia joiden nimessä on stringi "eipoisteta" ei poisteta
        if (stripos($file, "eipoisteta") === FALSE) {
            if ($nodelpict != '') {
                if (strpos($file, $nodelpict) === FALSE) {
                    ftp_delete($ftp_stream, $file);
                }
            } else {
                ftp_delete($ftp_stream, $file);
            }
        }
    }
}
Example #28
0
 public function putBouquets($folderName)
 {
     // delete existing files
     $files = ftp_nlist($this->_ftpStream, '/etc/enigma2/');
     foreach ($files as $fn) {
         if (pathinfo($fn, PATHINFO_EXTENSION) == 'tv') {
             ftp_delete($this->_ftpStream, $fn);
         }
     }
     // upload new files
     foreach (glob("{$folderName}/*.tv") as $filename) {
         $fn = pathinfo($filename, PATHINFO_BASENAME);
         ftp_put($this->_ftpStream, '/etc/enigma2/' . $fn, $filename, FTP_ASCII);
     }
 }
Example #29
0
 private function deleteFromOldCDN($fileName)
 {
     try {
         if ($fileName) {
             return true;
         }
         list($this->domain, $this->host, $this->user, $this->pass, $this->folder, $this->publiclink) = $this->CI->util->getCuadroFTPInfo();
         $conn = $this->CI->util->connectFTPServer('cuadro');
         if ($conn) {
             $path = $this->publiclink . $this->folder . '/';
             ftp_delete($conn, $path . $fileName);
             $this->CI->util->closeFTPConnection($conn);
         }
     } catch (RuntimeException $e) {
     }
 }
Example #30
-1
function deletebackup($file)
{
    global $conn_id;
    echo "Deleting " . $file . "...\n";
    if (ftp_delete($conn_id, $file)) {
        echo "success!\n";
    } else {
        echo "That didn't work... dang!\n";
    }
    return;
}