Question: I'm trying to move text files into a folder but ignore test.txt and all others will be moved to FileHolder folder. When I run it it still moves all the txt files to the folder.

```
private void testmodule()
{
    string filepath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
    DirectoryInfo d = new DirectoryInfo(filepath);

    List<String> AllDeskTopFiles = Directory.GetFiles(filepath, "*.txt*").ToList();

    foreach (string file in AllDeskTopFiles)
    {
        if (file != "test.txt")
        {
            FileInfo mFile = new FileInfo(file);
            if (new FileInfo(d + "\\FileHolder\\" + mFile.Name).Exists == false)
                mFile.MoveTo(d + "\\FileHolder\\" + mFile.Name);
        }
    }
}

```

Answer: 
Your `file` variable contains the full path.
Following should fix it, A cleaner way now:

```
private void testmodule()
{
    string filepath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
    DirectoryInfo d = new DirectoryInfo(filepath);

    List<String> AllDeskTopFiles = Directory.GetFiles(filepath, "*.txt*").ToList();

    foreach (string file in AllDeskTopFiles)
    {
        //if (file.ToLower().EndsWith("test.txt"))
        //{
        //    FileInfo mFile = new FileInfo(file);
        //    if (new FileInfo(d + "\\FileHolder\\" + mFile.Name).Exists == false)
        //        mFile.MoveTo(d + "\\FileHolder\\" + mFile.Name);
        //}
        FileInfo mFile = new FileInfo(file);
        if(mFile.Name.ToLower() != "test.txt")
        {
            if (new FileInfo(d + "\\FileHolder\\" + mFile.Name).Exists == false)
                mFile.MoveTo(d + "\\FileHolder\\" + mFile.Name);
        }
    }
}

```