Delete() 공개 메소드

Deletes the file If the file does not exist no error will be thrown (even if OnError is set to fail)
public Delete ( ) : void
리턴 void
예제 #1
0
        public FluentFileSample()
        {
            var file = new FluentFs.Core.File(@"c:\temp\test.txt");

            file.Copy.To(@"c:\temp\test2.txt");
            file.Move.To(@"c:\NewDirectory");
            file.Move.ContinueOnError.To(@"c:\DirectoryThatMayNotExist");
            file.Rename.To("test41.txt");
            file.Delete(OnError.Continue);

            var directory = new FluentFs.Core.Directory(@"c:\temp\sample");

            directory.Delete(OnError.Continue).Create(OnError.Fail);
            directory.Files();                                    //returns all files in the folder
            directory.Files("*.txt");                             //returns all files ending in .txt
            var childFolder = directory.SubFolder("childFolder"); //creates a new Directory object with a path of c:\temp\sample\childFolder

            directory.ToString();                                 //returns the path of the folder
            directory.File("test.txt");                           // returns back a FluentFilesystem.File object with a path of c:\temp\sample\test.txt

            var fileset = new FluentFs.Core.FileSet();

            fileset.Include(@"c:\Project\GUI\*.cs").RecurseAllSubDirectories
            .Exclude("assemblyInfo.cs")
            .Include(@"c:\Project\globalconfig.xml");

            ReadOnlyCollection <string> files = fileset.Files;

            fileset.Copy.To(@"c:\temp");
        }
예제 #2
0
        private void CompileCoreWithOutTests()
        {
            FileSet sourceFiles = new FileSet()
                                  .Include(directory_base.SubFolder("src").SubFolder("FluentBuild"))
                                  .RecurseAllSubDirectories.Filter("*.cs")
                                  .Exclude(directory_base.SubFolder("src").SubFolder("FluentBuild"))
                                  .RecurseAllSubDirectories.Filter("*Tests.cs")
                                  .Exclude(directory_base.SubFolder("src").SubFolder("FluentBuild").File("TestBase.cs").ToString());

            Task.Build.Csc.Target.Library(x => x.AddSources(sourceFiles)
                                          .AddRefences(thirdparty_sharpzip, thirdparty_fluentFs)
                                          .OutputFileTo(AssemblyFluentBuildRelease_Partial));

            Task.Run.ILMerge(x => x.ExecutableLocatedAt(@"tools\ilmerge\ilmerge.exe")
                             .AddSource(AssemblyFluentBuildRelease_Partial)
                             .AddSource(thirdparty_sharpzip)
                             .AddSource(thirdparty_fluentFs)
                             .OutputTo(AssemblyFluentBuildRelease_Merged));

            //now that it is merged delete the partial file
            AssemblyFluentBuildRelease_Partial.Delete();
        }
예제 #3
0
        public FluentFileSample()
        {
            var file = new FluentFs.Core.File(@"c:\temp\test.txt");
            file.Copy.To(@"c:\temp\test2.txt");
            file.Move.To(@"c:\NewDirectory");
            file.Move.ContinueOnError.To(@"c:\DirectoryThatMayNotExist");
            file.Rename.To("test41.txt");
            file.Delete(OnError.Continue);

            var directory = new FluentFs.Core.Directory(@"c:\temp\sample");
            directory.Delete(OnError.Continue).Create(OnError.Fail);
            directory.Files(); //returns all files in the folder
            directory.Files("*.txt"); //returns all files ending in .txt
            var childFolder = directory.SubFolder("childFolder"); //creates a new Directory object with a path of c:\temp\sample\childFolder
            directory.ToString(); //returns the path of the folder
            directory.File("test.txt"); // returns back a FluentFilesystem.File object with a path of c:\temp\sample\test.txt

            var fileset = new FluentFs.Core.FileSet();
            fileset.Include(@"c:\Project\GUI\*.cs").RecurseAllSubDirectories
              .Exclude("assemblyInfo.cs")
              .Include(@"c:\Project\globalconfig.xml");

            ReadOnlyCollection<string> files = fileset.Files;

            fileset.Copy.To(@"c:\temp");
        }