Example #1
0
        public static void copyFile(string file, string newName)
        {
            using (RemoteDeviceManager r = new RemoteDeviceManager())
            {
                using (RemoteDevice device = r.Devices.FirstConnectedDevice)
                {
                    string myDocs  = device.GetFolderPath(SpecialFolder.MyDocuments);
                    string newFile = myDocs + "\\" + newName;
                    string oldFile = myDocs + "\\" + file;

                    if (RemoteFile.Exists(device, myDocs + "\\" + file))
                    {
                        RemoteFile.Copy(device, oldFile, newFile, true);
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.Error.WriteLine("El archivo " + file + " no existe");
                        Console.ResetColor();
                    }
                }
            }
        }