Quantcast
Channel: Rebex Q&A Forum - Recent questions and answers
Viewing all articles
Browse latest Browse all 3862

Answered: Execute action when file is renamed

$
0
0

Hi,

This can be achieved using virtual file system API's notifier events.

When creating the FileServerUser object, instead of specifying the virtual path, use a LocalFileSystemProvider, associate it with the user, and register the RenameCompleted event:

var user01 = new FileServerUser("user01", "password", virtualRootPath);

var user01 = new FileServerUser("user01", "password");
var fs = new LocalFileSystemProvider(virtualRootPath);
user01.SetFileSystem(fs);

fs.GetFileSystemNotifier().RenameCompleted += (sender, args) =>
{
    Console.WriteLine("Renamed {0} -> {1}", args.OriginalNode.Path, args.ResultNode.Path);
};

Viewing all articles
Browse latest Browse all 3862

Trending Articles