Exemple #1
0
        /// <summary>
        /// Deletes a file at the specified path.
        /// </summary>
        /// <param name="path">The path of the file to delete.</param>
        public override void DeleteFile(string path)
        {
            try
            {
                Nfs3FileHandle handle = GetFile(path);
                if (handle != null && _client.GetAttributes(handle).Type == Nfs3FileType.Directory)
                {
                    throw new FileNotFoundException("No such file", path);
                }

                Nfs3FileHandle parent = GetParentDirectory(path);
                if (handle != null)
                {
                    _client.Remove(parent, Utilities.GetFileFromPath(path));
                }
            }
            catch (Nfs3Exception ne)
            {
                throw ConvertNfsException(ne);
            }
        }