I want to make a simple code that moves specific files from "Downloads" to another directory. If i run this program it should move this specific pdf-file to "PDFs"-directory:
Here is the code:
 public const string path = @"C:\Users\eduar\Downloads\";
    public const string newDic = @"C:\Users\eduar\Downloads\PDFs";
    public static void Main()
    {
        if (!Directory.Exists(newDic))
        {
            Directory.CreateDirectory(newDic);
        }
        Greetings();
        Console.ReadKey();
    }
    public static void Greetings()
    {
        Console.WriteLine("Hello, please press any key to sort all files in Downloads dictionary  \n");
        Console.ReadKey();
        var files = Directory.GetFiles(path);
        foreach (var file in files)
            if (Path.GetExtension(file) == ".pdf")
            {
                try
                {
                    File.Move(file, newDic, true);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
    }
Here is the ERROR-code:
PS: im new to Stackoverflow didnt notice that part. The whole question is above.


 
    