⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file.n

📁 tcl是工具命令语言
💻 N
📖 第 1 页 / 共 2 页
字号:
\fI-linktype\fR are "-symbolic" and "-hard"..When creating links on filesystems that either do not support any links,or do not support the specific type requested, an error message will bereturned.  In particular Windows 95, 98 and ME do not support any linksat present, but most Unix platforms support both symbolic and hard links(the latter for files only), MacOS supports symbolic links and WindowsNT/2000/XP (on NTFS drives) support symbolic directory links and hardfile links..TP\fBfile lstat \fIname varName\fR.Same as \fBstat\fR option (see below) except uses the \fIlstat\fRkernel call instead of \fIstat\fR.  This means that if \fIname\fRrefers to a symbolic link the information returned in \fIvarName\fRis for the link rather than the file it refers to.  On systems thatdon't support symbolic links this option behaves exactly the sameas the \fBstat\fR option..TP\fBfile mkdir \fIdir\fR ?\fIdir\fR ...?.Creates each directory specified.  For each pathname \fIdir\fR specified,this command will create all non-existing parent directories aswell as \fIdir\fR itself.  If an existing directory is specified, thenno action is taken and no error is returned.  Trying to overwrite an existingfile with a directory will result in an error.  Arguments are processed inthe order specified, halting at the first error, if any..TP\fBfile mtime \fIname\fR ?\fItime\fR?.Returns a decimal string giving the time at which file \fIname\fR was lastmodified.  If \fItime\fR is specified, it is a modification time to set forthe file (equivalent to Unix \fBtouch\fR).  The time is measured in thestandard POSIX fashion as seconds from a fixed starting time (often January1, 1970).  If the file doesn't exist or its modified time cannot be queriedor set then an error is generated..TP\fBfile nativename \fIname\fR.Returns the platform-specific name of the file. This is useful if thefilename is needed to pass to a platform-specific call, such as execunder Windows or AppleScript on the Macintosh..TP\fBfile normalize \fIname\fR..RSReturns a unique normalised path representation for the file-systemobject (file, directory, link, etc), whose string value can be used as aunique identifier for it.  A normalized path is an absolute path which hasall '../', './' removed.  Also it is one which is in the ``standard''format for the native platform.  On MacOS, Unix, this means the segmentsleading up to the path must be free of symbolic links/aliases (but thevery last path component may be a symbolic link), and on Windows it alsomeans means we want the long form with that form's case-dependence (whichgives us a unique, case-dependent path).  The one exception concerning thelast link in the path is necessary, because Tcl or the user may wish tooperate on the actual symbolic link itself (for example 'file delete', 'filerename', 'file copy' are defined to operate on symbolic links, not on thethings that they point to)..RE.TP\fBfile owned \fIname\fR .Returns \fB1\fR if file \fIname\fR is owned by the current user, \fB0\fRotherwise..TP\fBfile pathtype \fIname\fR.Returns one of \fBabsolute\fR, \fBrelative\fR, \fBvolumerelative\fR.  If\fIname\fR refers to a specific file on a specific volume, the path typewill be \fBabsolute\fR.  If \fIname\fR refers to a file relative to thecurrent working directory, then the path type will be \fBrelative\fR.  If\fIname\fR refers to a file relative to the current working directory ona specified volume, or to a specific file on the current working volume, thenthe file type is \fBvolumerelative\fR..TP\fBfile readable \fIname\fR.Returns \fB1\fR if file \fIname\fR is readable by the current user,\fB0\fR otherwise. .TP\fBfile readlink \fIname\fR.Returns the value of the symbolic link given by \fIname\fR (i.e. the nameof the file it points to).  If \fIname\fR isn't a symbolic link or itsvalue cannot be read, then an error is returned.  On systems that don'tsupport symbolic links this option is undefined..TP\fBfile rename \fR?\fB\-force\fR? ?\fB\-\|\-\fR? \fIsource\fR \fItarget\fR.TP\fBfile rename \fR?\fB\-force\fR? ?\fB\-\|\-\fR? \fIsource\fR ?\fIsource\fR ...? \fItargetDir\fR.RSThe first form takes the file or directory specified by pathname\fIsource\fR and renames it to \fItarget\fR, moving the file if thepathname \fItarget\fR specifies a name in a different directory.  If\fItarget\fR is an existing directory, then the second form is used.The second form moves each \fIsource\fR file or directory into thedirectory \fItargetDir\fR. Existing files will not be overwrittenunless the \fB\-force\fR option is specified.  When operating inside asingle filesystem, Tcl will rename symbolic links rather than thethings that they point to.  Trying to overwrite a non-empty directory,overwrite a directory with a file, or a file with a directory will allresult in errors.  Arguments are processed in the order specified,halting at the first error, if any.  A \fB\-\|\-\fR marks the end ofswitches; the argument following the \fB\-\|\-\fR will be treated as a\fIsource\fR even if it starts with a \fB\-\fR..RE.TP\fBfile rootname \fIname\fR.Returns all of the characters in \fIname\fR up to but not including thelast ``.'' character in the last component of name.  If the lastcomponent of \fIname\fR doesn't contain a dot, then returns \fIname\fR..TP\fBfile separator\fR ?\fIname\fR?.If no argument is given, returns the character which is used to separate path segments for native files on this platform.  If a path is given,the filesystem responsible for that path is asked to return itsseparator character.  If no file system accepts \fIname\fR, an erroris generated..TP\fBfile size \fIname\fR.Returns a decimal string giving the size of file \fIname\fR in bytes.  Ifthe file doesn't exist or its size cannot be queried then an error isgenerated..TP\fBfile split \fIname\fR.Returns a list whose elements are the path components in \fIname\fR.  Thefirst element of the list will have the same path type as \fIname\fR.All other elements will be relative.  Path separators will be discardedunless they are needed ensure that an element is unambiguously relative.For example, under Unix.RS.CSfile split /foo/~bar/baz.CEreturns \fB/\0\0foo\0\0./~bar\0\0baz\fR to ensure that later commandsthat use the third component do not attempt to perform tildesubstitution..RE.TP\fBfile stat  \fIname varName\fR.Invokes the \fBstat\fR kernel call on \fIname\fR, and uses the variablegiven by \fIvarName\fR to hold information returned from the kernel call.\fIVarName\fR is treated as an array variable, and the following elementsof that variable are set: \fBatime\fR, \fBctime\fR, \fBdev\fR, \fBgid\fR,\fBino\fR, \fBmode\fR, \fBmtime\fR, \fBnlink\fR, \fBsize\fR, \fBtype\fR,\fBuid\fR.  Each element except \fBtype\fR is a decimal string with thevalue of the corresponding field from the \fBstat\fR return structure;see the manual entry for \fBstat\fR for details on the meanings of thevalues.  The \fBtype\fR element gives the type of the file in the sameform returned by the command \fBfile type\fR.  This command returns anempty string..TP\fBfile system \fIname\fR.Returns a list of two elements, the first of which is the name of thefilesystem to use for the file, and the second an arbitrary stringrepresenting the filesystem-specific nature or type of the locationwithin that filesystem.  If a filesystem only supports one type of file,the second element may be null.  For example the native files have afirst element 'native', and a second element which is a platform-specifictype name for the file's system (e.g. 'NTFS', 'FAT', etc), or possiblythe empty string if no further information is available or if thisis not implemented.  A generic virtual file system might return thelist 'vfs ftp' to represent a file on a remote ftp site mounted as avirtual filesystem through an extension called 'vfs'.  If the file doesnot belong to any filesystem, an error is generated..TP\fBfile tail \fIname\fR.Returns all of the characters in \fIname\fR after the last directoryseparator.  If \fIname\fR contains no separators then returns\fIname\fR..TP\fBfile type \fIname\fR.Returns a string giving the type of file \fIname\fR, which will be one of\fBfile\fR, \fBdirectory\fR, \fBcharacterSpecial\fR, \fBblockSpecial\fR,\fBfifo\fR, \fBlink\fR, or \fBsocket\fR..TP\fBfile volumes\fR. Returns the absolute paths to the volumes mounted on the system, as aproper Tcl list.  On the Macintosh, this will be a list of the mounteddrives, both local and network.  N.B. if two drives have the same name,they will both appear on the volume list, but there is currently no way,from Tcl, to access any but the first of these drives.  On UNIX, thecommand will always return "/", since all filesystems are locally mounted.On Windows, it will return a list of the available local drives(e.g. {a:/ c:/})..TP\fBfile writable \fIname\fR.Returns \fB1\fR if file \fIname\fR is writable by the current user,\fB0\fR otherwise..SH "PORTABILITY ISSUES".TP\fBUnix\fR\0\0\0\0\0\0\0.These commands always operate using the real user and group identifiers,not the effective ones. .SH "SEE ALSO"filename(n), open(n), close(n), eof(n), gets(n), tell(n), seek(n),fblocked(n), flush(n).SH KEYWORDSattributes, copy files, delete files, directory, file, move files, name, rename files, stat

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -