此为 Mathematica 7 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.1)

Manipulating Files and Directories

CopyFile["file1","file2"]copy file1 to file2
RenameFile["file1","file2"]give file1 the name file2
DeleteFile["file"]delete a file
FileByteCount["file"]give the number of bytes in a file
FileDate["file"]give the modification date for a file
SetFileDate["file"]set the modification date for a file to be the current date
FileType["file"]give the type of a file as File, Directory or None

Functions for manipulating files.

Different operating systems have different commands for manipulating files. Mathematica provides a simple set of file manipulation functions, intended to work in the same way under all operating systems.
Notice that CopyFile and RenameFile give the final file the same modification date as the original one. FileDate returns modification dates in the {year, month, day, hour, minute, second} format used by DateList.
CreateDirectory["name"]create a new directory
DeleteDirectory["name"]delete an empty directory
DeleteDirectory["name",DeleteContents->True]delete a directory and all files and directories it contains
RenameDirectory["name1","name2"]rename a directory
CopyDirectory["name1","name2"]copy a directory and all the files in it

Functions for manipulating directories.