Deletes a list of files. Returns the number of files successfully deleted.
$cnt = unlink 'a', 'b', 'c';
unlink @goners;
unlink <*.bak>;
Note: unlink will not delete directories unless you are superuser and the -U flag is supplied to Perl. Even if these conditions are met, be warned that unlinking a directory can inflict damage on your filesystem. Use rmdir instead.
用api函数 DeleteFile,
具体可以看msdn上的用法:
DeleteFile
This function deletes an existing file from a file system. It can also delete an unmounted database volume. A remote application interface (RAPI) version of this function exists, and it is named CeDeleteFile.
BOOL DeleteFile(
LPCTSTR lpFileName );
Parameters
lpFileName
[in] Pointer to a null-terminated string that specifies the file or database volume to be deleted.
Return Values
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
Remarks
If an application attempts to delete a file that does not exist, the DeleteFile function fails.
Use the RemoveDirectory function to delete a directory.
The DeleteFile function fails if an application attempts to delete a file that is open for normal I/O or as a memory-mapped file.
To close an open file handle, use the CloseHandle function.
To unmount a database volume, use the CeUnmountDBVol function.