I am writing a program in C that sends files over the network using sockets. It works fine for files - they are read in buffer and then written on the socket, they are pushed back to the other end of the process.
However, how can this be applied to directories? I also want to copy the directory, keeping the permissions the same (so I do not think mkdir will work). At the moment when I try to run it on a directory, it says that size is -1. How is the directory represented?
To be clear, for example, if I want to copy my program / TMP over the network, then it will:
/ tmp / 1 Txt - ok / tmp / dot / - / tmp / dir / - leave / ttp / dir / 3 wpt - properly
I think this is a homework, otherwise the FTP, scp
, rsync
, unison
etc.
To check that a file path is a plain file, a device, directory, etc etc ... use
to read a directory, then loop on it Use (then definitely close
). You should know how the directory is displayed.
You probably should be interested in crossing a file tree again.
To create a directory,
you should read
BTW, it also has useful information ...
No comments:
Post a Comment