Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Synchronization speed

This is WinSCP forum and in your original question you were writing about "remote fileserver". So I have assumed that you are asking about SFTP "readdir" request. If you are asking about local system's readdir function then I cannot help you.
Dan Lewis

Synchronization speed

Hi Martin,

You should get all information you need from the "readdir" already, you do not need to call "stat" for each file.

According to the Linux manual page at https://man7.org/linux/man-pages/man3/readdir.3.html, the glibc implementation of readdir doesn't necessarily return modification time:

In the glibc implementation, the dirent structure is defined as follows:
struct dirent {
    ino_t          d_ino;       /* Inode number */
    off_t          d_off;       /* Not an offset; see below */
    unsigned short d_reclen;    /* Length of this record */
    unsigned char  d_type;      /* Type of file; not supported by all filesystem types */
    char           d_name[256]; /* Null-terminated filename */
};

The only fields in the dirent structure that are mandated by POSIX.1 are d_name
and d_ino. The other fields are unstandardized, and not present on all systems.

What am I missing?
Dan
martin

Re: Synchronization speed

You should get all information you need from the "readdir" already, you do not need to call "stat" for each file.
Dan Lewis

Synchronization speed

I'm building a program in C that needs to run the stat function on more than 16,000 files stored on a remote fileserver. Using C library functions opendir and readdir, my code takes far longer than the time required to do a synchronization scan with WinSCP.

Perhaps it's an unfair question, but how does WinSCP achieve such speed when comparing local versus remote file attributes?

Thanks,
Dan