Пример #1
0
        public async Task <IFileStoreEntry> GetFileInfoAsync(string path)
        {
            if (await _ftpClient.FileExistsAsync(path))
            {
                //var fileInfo = await _ftpClient.GetObjectInfoAsync(path);
                //var fileInfo = await _ftpClient.GetFilePermissionsAsync(path);

                //var fileSize = await _ftpClient.GetFileSizeAsync(path);
                //var fileModifiedTime = await _ftpClient.GetModifiedTimeAsync(path);

                var fileInfo = (await _ftpClient.GetListingAsync(path)).FirstOrDefault();
                return(new FtpStoreEntry(path, fileInfo));
            }
            return(null);
        }
Пример #2
0
        public override async Task <IEnumerable <FtpEntry> > ListDirectoryAsync(string path = null, CancellationToken ctk = default)
        {
            var lst = await _client.GetListingAsync(path, FtpListOption.Auto);

            var res = lst.Select(x => new FtpEntry()
            {
                FullPath    = x.FullName,
                IsDirectory = x.Type == FtpFileSystemObjectType.Directory,
                Modified    = x.Modified,
                Name        = x.Name,
                Size        = x.Size
            }).ToList();

            return(res);
        }