Ejemplo n.º 1
0
        /// <summary>
        /// Gets information of a directory.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static FilesystemInfo GetDirectoryInfo(String path)
        {
            var fsInfo = new FilesystemInfo
            {
                Path   = path,
                Exists = DirectoryExists(path, 1000)
            };

            if (fsInfo.Exists)
            {
                ulong available;
                ulong total;
                ulong free;
                GetDiskFreeSpaceEx(path, out available, out total, out free);

                fsInfo.FreeSizeInKB = available / 1024;
                fsInfo.SizeInKB     = total / 1024;
            }

            return(fsInfo);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets information of a directory.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static FilesystemInfo GetDirectoryInfo(String path)
        {
            var fsInfo = new FilesystemInfo
                             {
                                 Path = path,
                                 Exists = DirectoryExists(path, 1000)
                             };

            if (fsInfo.Exists)
            {
                ulong available;
                ulong total;
                ulong free;
                GetDiskFreeSpaceEx(path, out available, out total, out free);

                fsInfo.FreeSizeInKB = available / 1024;
                fsInfo.SizeInKB = total / 1024;

            }

            return fsInfo;
        }