Delete file

Jmnote (토론 | 기여)님의 2014년 8월 31일 (일) 19:27 판
  다른 뜻에 대해서는 리눅스 unlink 문서를 참조하십시오.
unlink
rm

1 Bash

Bash
Copy
echo 'John Smith' > /tmp/a.txt
if [ ! -f /tmp/a.txt ]; then echo 'File not found #1'; fi

rm -f /tmp/a.txt
if [ ! -f /tmp/a.txt ]; then echo 'File not found #2'; fi
# File not found #2

2 PHP

PHP
Copy
file_put_contents('/tmp/a.txt', 'unlinkJohn Smith');
if( !file_exists('/tmp/a.txt') ) echo 'File not found #1'.PHP_EOL;

unlink('/tmp/a.txt');
if( !file_exists('/tmp/a.txt') ) echo 'File not found #2'.PHP_EOL;
// File not found #2

3 같이 보기