SharpCifs.Smb.SmbFile.RenameTo C# (CSharp) 메소드

RenameTo() 공개 메소드

Changes the name of the file this SmbFile represents to the name designated by the SmbFile argument.
Changes the name of the file this SmbFile represents to the name designated by the SmbFile argument.

Remember: SmbFiles are immutible and therefore the path associated with this SmbFile object will not change). To access the renamed file it is necessary to construct a new SmbFile.

If the dest argument is null ///
public RenameTo ( SmbFile dest ) : void
dest SmbFile An SmbFile that represents the new pathname
리턴 void
        public virtual void RenameTo(SmbFile dest)
        {
            if (GetUncPath0().Length == 1 || dest.GetUncPath0().Length == 1)
            {
                throw new SmbException("Invalid operation for workgroups, servers, or shares");
            }
            ResolveDfs(null);
            dest.ResolveDfs(null);
            if (!Tree.Equals(dest.Tree))
            {
                throw new SmbException("Invalid operation for workgroups, servers, or shares");
            }
            if (Log.Level >= 3)
            {
                Log.WriteLine("renameTo: " + Unc + " -> " + dest.Unc);
            }
            _attrExpiration = _sizeExpiration = 0;
            dest._attrExpiration = 0;
            Send(new SmbComRename(Unc, dest.Unc), Blank_resp());
        }