1234567891011121314151617181920212223242526272829303132333435 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using Microsoft.VisualBasic.FileIO;
- using System.IO;
- namespace CommonFroms
- {
- public static class FileSystem
- {
- public static int DeleteToRecycleBin(string path)
- {
- if (File.Exists(path))
- {
- Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile(
- path,
- UIOption.OnlyErrorDialogs,
- RecycleOption.SendToRecycleBin);
- }
- else if (Directory.Exists(path))
- {
- Microsoft.VisualBasic.FileIO.FileSystem.DeleteDirectory(
- path,
- UIOption.OnlyErrorDialogs,
- RecycleOption.SendToRecycleBin);
- }
- return 0;
- }
- }
- }
|