Delete a large number (>100K) of files with c# whilst maintaining performance in a web application?

前端 未结 10 2121
[愿得一人]
[愿得一人] 2020-12-30 04:40

I am trying to remove a large number of files from a location (by large I mean over 100000), whereby the action is initated from a web page. Obviously I cou

10条回答
  •  悲&欢浪女
    2020-12-30 05:14

    Boot the work out to a worker thread and then return your response to the user.

    I'd flag up a application variable to say that you are doing "the big delete job" to stop running multiple threads doing the same work. You could then poll another page which could give you a progress update of the number of files removed so far too if you wanted to?

    Just a query but why so many files?

提交回复
热议问题