eFilesystem
[ class tree: eFilesystem ] [ index: eFilesystem ] [ all elements ]

Class: eFilesystem

Source Location: /eFilesystem/eFilesystem.php

Class Overview

ePrint
   |
   --eFilesystem

파일 시스템 확장 API를위한 기본 Class


Constants

Methods



Class Details

[line 37]
파일 시스템 확장 API를위한 기본 Class



[ Top ]


Class Methods


static method dirlist [line 290]

static array|false dirlist( string $path, [integer $fullpath = false])

주어진 디렉토리 하위의 리스트를 배열로 반환

예제:

  1.     echo "4. check dirlist ...\n";
  2.     $r eFilesystem::dirlist ('./');
  3.     $r array_merge ($reFilesystem::dirlist ('./'eFilesystem::RELATIVE));
  4.     $r array_merge ($reFilesystem::dirlist ('./'eFilesystem::ABSOLUTE));
  5.     ePrint::echoi ($r4);
  6.     echo "\n";




Tags:

access:  public


Parameters:

string   $path   리스트를 얻을 디렉토리 경로
integer   $fullpath   (optional) 기본값 false.
false일 경우, 파일 또는 디렉토리의 이름만 반환
eFilesystem::RELATIVE일 경우, 상대 경로로 반환
eFilesystem::ABSOLUTE일 경우, 절대 경로로 반환

[ Top ]

static method file_nr [line 66]

static array|false file_nr( string $f, [boolean $use_include_path = false], [resource $resource = null])

파일을 읽어서 각 라인을 배열로 만들어 반환

file_nr mothod는 php의 file 함수와 동일하게 작동을 한다. 하지만 file_nr method는 file 함수와는 달리 각 행의 개행을 포함하지 않는다.

예제:

  1.     echo '1. check file_nr ... ';
  2.     $r eFilesystem::file_nr ('eFilesystem.php');
  3.     answer (is_array ($rtrue false);




Tags:

return:  파일의 각 행을 배열로 반환. 파일이 존재하지 않거나 파일이 아니면 false를 반환한다.
access:  public


Parameters:

string   $f   파일 경로
boolean   $use_include_path   (optional) true로 설정이 되면, php의 include_path 에서 파일을 찾는다. 기본값은 false.
resource   $resource   (optional) file description resource가 지정이 되면, 첫번째 파일 경로 인자의 값을 무시하고, 이 file description에서 파일의 내용을 읽는다. 기본값은 null 이다.

[ Top ]

static method find [line 421]

static array|false find( [string $path = './'], [string $type = ''], [boolean $norecursive = false])

주어진 경로 하위의 디렉토리/파일 리스트를 배열로 반환

주어진 경로 하위의 디렉토리/파일들을 조건에 맞게 탐색을 하여 결과를 배열로 반환한다.

예제:

  1.     echo "5. check find ... \n";
  2.     $r eFilesystem::find ('./');
  3.     ePrint::echoi ($r4);
  4.     echo "\n\n";




Tags:

return:  파일 리스트를 배열로 반환. 경로를 지정하지 않았거나, 또는 주어진 경로가 존재하지 않으면 false를 반환
access:  public


Parameters:

string   $path   (optional) 탐색할 경로. 기본값은 현재 디렉토리(./)
string   $type   (optional) 탐색 조건. 기본값은 모든 파일/디렉토리를 탐색한다.
  • f (파일만 탐색)
  • d (디렉토리만 탐색)
  • l (링크만 탐색)
  • fd (파일과 디렉토리만 탐색)
  • fl (파일과 링크만 탐색)
  • dl (디렉토리와 링크만 탐색)
  • /regex/ (파일/디렉토리 이름을 정규식으로 탐색)
boolean   $norecursive   (optional) 기본값 false. true로 설정하면, 재귀 검색을 하지않고, 지정된 디렉토리의 리스트만 반환 한다.

[ Top ]

static method make_ini [line 720]

static string make_ini( array|stdClass $input)

eFilesystem::parse_ini method에 대응되는 설정을 생성한다.



Tags:

return:  생성된 설정 문자열
since:  버전 1.0.2
access:  public


Parameters:

array|stdClass   $input   eFilesystem::parse_ini와 동일한 형식을 가진 설정 배열

[ Top ]

static method mkdir_p [line 111]

static boolean mkdir_p( string $path, [int $mode = 0777])

주어진 경로에 디렉토리를 생성한다.

부모 디렉토리가 존재하지 않더라도, 이 API는 디렉토리를 생성하는데 실패 하지 않는다. 이 method는 php 의 mkdir (path, mode, true)와 동일하게 동작 한다. 시스템상에서 'mkdir -p path'와 같이 실행하는 것과 동일한 결과를 가진다.

예제:

  1.     echo '2. check mkdir_p ... ';
  2.     #echo ePrint::whiteSpace (4, true) . "indent 4\n";
  3.     $r eFilesystem::mkdir_p ('./aaa/bbb');
  4.     answer ($r);
  5.     if $r === true {
  6.         chdir ('./aaa/bbb');
  7.         touch ('11.txt');
  8.         touch ('1.txt');
  9.         touch ('2.txt');
  10.         chdir ('../../');
  11.  
  12.         echo "   check tree ... \n";
  13.         ob_start ();
  14.         eFilesystem::tree ('./aaa');
  15.         $capture ob_get_contents ();
  16.         ob_end_clean ();
  17.         ePrint::echoi ($capture4);
  18.     }




Tags:

return:  생성에 실패하면 false를 반환하고, 성공하면 true를 환한다.
since:  버전 1.0.2 부터 return 값이 boolean으로만 반환
access:  public


Parameters:

string   $path   생성할 경로
int   $mode   (optional) 기본값 0777. 이 의미는 누구나 접근 및 쓰기가 가능함을 의미한다. mode에 대한 더 많은 정보는 php의 chmod() 문서를 참고 한다.

[ Top ]

static method parse_ini [line 532]

static array|stdClass parse_ini( string $f, [bool $obj = false])

설정 파일 또는 설정 문자열을 분석



Tags:

return:  성공시에, 분석된 설정 내용을 배열로 반환 한다. 실패시에 빈 배열을 반환한다.
since:  버전 1.0.1
access:  public


Parameters:

string   $f   설정 파일 또는 설정 문자열
bool   $obj   (optional) true로 선언시에, member들을 stdClass로 반환한다. (1.0.3부터 지원)

[ Top ]

static method prompt [line 487]

static string prompt( string $prompt, [boolean $hidden = false])

쉘 라인 프롬프트를 출력하고 입력된 값을 반환한다.



Tags:

access:  public


Parameters:

string   $prompt   stdout으로 출력할 프롬프트 문자열
boolean   $hidden   (optional) input 문자열을 hidden 처리 한다.

[ Top ]

static method safe_unlink [line 140]

static bolean|int safe_unlink( string $f)

Deletes a file. If given file is directory, no error and return false.

파일을 삭제 한다.

주어진 값이 존재하지 않거나 디렉토리일 경우에도 에러를 발생 시키지 않는다.




Tags:

return:  성공시에 true를 반환
삭제 실패시에 false를 반환
삭제할 파일이 없을 경우 2를 반환
삭제할 파일이 디렉토리일 경우 삭제하지 않고 3을 반환
access:  public


Parameters:

string   $f   삭제할 경로

[ Top ]

static method tree [line 345]

static stdClass tree( [string $dir = '.'], [string $prefix = ''], [boolean $recursive = false])

지정한 경로의 디렉토리 tree를 출력

시스템상의 tree 명령의 결과와 비슷하게 출력한다.

예제:

  1.     echo '2. check mkdir_p ... ';
  2.     #echo ePrint::whiteSpace (4, true) . "indent 4\n";
  3.     $r eFilesystem::mkdir_p ('./aaa/bbb');
  4.     answer ($r);
  5.     if $r === true {
  6.         chdir ('./aaa/bbb');
  7.         touch ('11.txt');
  8.         touch ('1.txt');
  9.         touch ('2.txt');
  10.         chdir ('../../');
  11.  
  12.         echo "   check tree ... \n";
  13.         ob_start ();
  14.         eFilesystem::tree ('./aaa');
  15.         $capture ob_get_contents ();
  16.         ob_end_clean ();
  17.         ePrint::echoi ($capture4);
  18.     }




Tags:

return:  파일과 디렉토리 수를 반환
   stdClass Object
   (
       [file] => 파일 수
       [dir]  => 디렉토리 수
   )
access:  public


Parameters:

string   $dir   (optional) 주어진 경로. 기본값은 현재 디렉토리(./)
string   $prefix   (optional) 재귀 호출을 위해 사용. 이 파라미터는 사용하지 않는다.
boolean   $recursive   (optional) 재귀 호출을 위해 사용. 이 파라미터는 사용하지 않는다.

[ Top ]

static method unlink_r [line 194]

static boolean unlink_r( string $path)

주어진 경로의 파일이나 디렉토리를 삭제

주어진 경로의 파일이나 디렉토리를 삭제 합니다. 디렉토리 삭제시에, 해당 디렉토리에 파일이나 하위 디렉토리가 포함하더라도 모두 삭제를 한다.

예제:

  1.     echo '3. check unlink_r ... ';
  2.     $r eFilesystem::unlink_r ('./aaa');
  3.     answer ($r);




Tags:

access:  public


Parameters:

string   $path   삭제할 경로 경로에 아스트리크(*)나 쉘 확장({a,b})을 사용할 수 있다.

[ Top ]


Class Constants

ABSOLUTE =  2

[line 40]


[ Top ]

RELATIVE =  1

[line 39]


[ Top ]



Documentation generated on Tue, 14 May 2019 02:00:00 +0900 by phpDocumentor 1.4.4