Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
feat(presets): Copy to folder can move the files instead of copying them
lightscape-jm978b6123f818
diff --git a/src/Filee.App/Assets/i18n/ar.json b/src/Filee.App/Assets/i18n/ar.jsonindex 4d89df20..3942c8f1 100644--- a/src/Filee.App/Assets/i18n/ar.json+++ b/src/Filee.App/Assets/i18n/ar.json@@ -140,6 +140,7 @@"notice.original_kept": "تم الاحتفاظ بالأصل وحُفظت النتيجة كنسخة","notice.original_in_trash": "الأصل في سلة المحذوفات، واحتفظت النتيجة باسمها","notice.original_unchanged": "تعذّر تصغيره، لذا تُرك الأصل كما هو",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "لا توجد سلة محذوفات على هذا القرص","trash.in_use": "الملف مفتوح في برنامج آخر","trash.read_only": "الملف للقراءة فقط",@@ -1271,5 +1272,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/de.json b/src/Filee.App/Assets/i18n/de.jsonindex 23e57ebc..87205108 100644--- a/src/Filee.App/Assets/i18n/de.json+++ b/src/Filee.App/Assets/i18n/de.json@@ -140,6 +140,7 @@"notice.original_kept": "Das Original wurde beibehalten und das Ergebnis als Kopie gespeichert","notice.original_in_trash": "Das Original liegt im Papierkorb. Das Ergebnis hat seinen eigenen Namen behalten","notice.original_unchanged": "Die Datei ließ sich nicht verkleinern. Das Original blieb unverändert",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "dieses Laufwerk hat keinen Papierkorb","trash.in_use": "die Datei ist in einem anderen Programm geöffnet","trash.read_only": "die Datei ist schreibgeschützt",@@ -1270,5 +1271,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.jsonindex c24a2de0..4d1945ee 100644--- a/src/Filee.App/Assets/i18n/en.json+++ b/src/Filee.App/Assets/i18n/en.json@@ -146,6 +146,7 @@"notice.original_kept": "The original was kept, the result was saved as a copy","notice.original_in_trash": "The original is in the Recycle Bin / Trash, the result kept its own name","notice.original_unchanged": "Couldn't make it smaller, so the original was left as it is",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "this drive has no Recycle Bin / Trash","trash.in_use": "the file is open in another program","trash.read_only": "the file is read-only",@@ -1292,5 +1293,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/es.json b/src/Filee.App/Assets/i18n/es.jsonindex c672c7e9..9e004134 100644--- a/src/Filee.App/Assets/i18n/es.json+++ b/src/Filee.App/Assets/i18n/es.json@@ -140,6 +140,7 @@"notice.original_kept": "Se conservó el original, el resultado se guardó como copia","notice.original_in_trash": "El original está en la Papelera, el resultado conservó su propio nombre","notice.original_unchanged": "No se pudo hacer más pequeño, así que el original se dejó como estaba",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "esta unidad no tiene Papelera de reciclaje","trash.in_use": "el archivo está abierto en otro programa","trash.read_only": "el archivo es de solo lectura",@@ -1272,5 +1273,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/fr.json b/src/Filee.App/Assets/i18n/fr.jsonindex 7542f9e9..70b432ad 100644--- a/src/Filee.App/Assets/i18n/fr.json+++ b/src/Filee.App/Assets/i18n/fr.json@@ -146,6 +146,7 @@"notice.original_kept": "L'original a été conservé, le résultat a été enregistré en copie","notice.original_in_trash": "L'original est dans la Corbeille, le résultat a gardé son propre nom","notice.original_unchanged": "Impossible de le rendre plus petit : l'original a été laissé tel quel",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "ce lecteur n'a pas de Corbeille","trash.in_use": "le fichier est ouvert dans un autre programme","trash.read_only": "le fichier est en lecture seule",@@ -1292,5 +1293,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/hi.json b/src/Filee.App/Assets/i18n/hi.jsonindex fc1be047..69732972 100644--- a/src/Filee.App/Assets/i18n/hi.json+++ b/src/Filee.App/Assets/i18n/hi.json@@ -140,6 +140,7 @@"notice.original_kept": "मूल फ़ाइल रखी गई, परिणाम कॉपी के रूप में सहेजा गया","notice.original_in_trash": "मूल फ़ाइल रीसायकल बिन / ट्रैश में है, परिणाम ने अपना नाम रखा","notice.original_unchanged": "इसे छोटा नहीं किया जा सका, इसलिए मूल फ़ाइल जैसी थी वैसी छोड़ दी गई",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "इस ड्राइव में रीसायकल बिन / ट्रैश नहीं है","trash.in_use": "फ़ाइल किसी दूसरे प्रोग्राम में खुली है","trash.read_only": "फ़ाइल केवल पढ़ने के लिए है",@@ -1272,5 +1273,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/id.json b/src/Filee.App/Assets/i18n/id.jsonindex 49e2bfd6..b187570f 100644--- a/src/Filee.App/Assets/i18n/id.json+++ b/src/Filee.App/Assets/i18n/id.json@@ -140,6 +140,7 @@"notice.original_kept": "File asli dipertahankan, hasil konversi disimpan sebagai salinan","notice.original_in_trash": "File asli ada di Tong Sampah, hasil konversi mempertahankan namanya sendiri","notice.original_unchanged": "Ukuran tidak dapat diperkecil lagi, sehingga file asli dibiarkan apa adanya",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "drive ini tidak memiliki Tong Sampah","trash.in_use": "file sedang terbuka di program lain","trash.read_only": "file bersifat hanya-baca (read-only)",@@ -1270,5 +1271,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/it.json b/src/Filee.App/Assets/i18n/it.jsonindex 982e035c..e3fdc9f0 100644--- a/src/Filee.App/Assets/i18n/it.json+++ b/src/Filee.App/Assets/i18n/it.json@@ -140,6 +140,7 @@"notice.original_kept": "L'originale è stato conservato, il risultato è stato salvato come copia","notice.original_in_trash": "L'originale è nel Cestino, il risultato ha mantenuto il proprio nome","notice.original_unchanged": "Impossibile ridurlo, quindi l'originale è stato lasciato com'è",+"notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "questa unità non ha un Cestino","trash.in_use": "il file è aperto in un altro programma","trash.read_only": "il file è di sola lettura",@@ -1270,5 +1271,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/ja.json b/src/Filee.App/Assets/i18n/ja.jsonindex 3ff6150e..610f582f 100644--- a/src/Filee.App/Assets/i18n/ja.json+++ b/src/Filee.App/Assets/i18n/ja.json@@ -140,6 +140,7 @@"notice.original_kept": "元のファイルを残し、結果をコピーとして保存しました","notice.original_in_trash": "元のファイルはごみ箱にあります。結果は別の名前のままです","notice.original_unchanged": "小さくできなかったため、元のファイルはそのままにしました",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "このドライブにはごみ箱がありません","trash.in_use": "ファイルが別のプログラムで開かれています","trash.read_only": "ファイルが読み取り専用です",@@ -1272,5 +1273,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.jsonindex 5155834a..c21510c5 100644--- a/src/Filee.App/Assets/i18n/ko.json+++ b/src/Filee.App/Assets/i18n/ko.json@@ -146,6 +146,7 @@"notice.original_kept": "원본은 그대로 두고 결과를 사본으로 저장했어요","notice.original_in_trash": "원본은 휴지통으로 옮겼고, 결과는 저장된 이름 그대로예요","notice.original_unchanged": "더 작게 만들지 못해서 원본을 그대로 두었어요",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "이 드라이브에는 휴지통이 없어요","trash.in_use": "다른 프로그램에서 파일을 열고 있어요","trash.read_only": "읽기 전용 파일이에요",@@ -1292,5 +1293,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/ne.json b/src/Filee.App/Assets/i18n/ne.jsonindex 64721b64..77ac925f 100644--- a/src/Filee.App/Assets/i18n/ne.json+++ b/src/Filee.App/Assets/i18n/ne.json@@ -140,6 +140,7 @@"notice.original_kept": "मूल फाइल राखियो, नतिजा प्रतिलिपिको रूपमा सुरक्षित भयो","notice.original_in_trash": "मूल फाइल रिसाइकल बिन / ट्र्यासमा छ, नतिजाले आफ्नै नाम राख्यो","notice.original_unchanged": "यसलाई सानो बनाउन सकिएन, त्यसैले मूल फाइल जस्ताको तस्तै छोडियो",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "यो ड्राइभमा रिसाइकल बिन / ट्र्यास छैन","trash.in_use": "फाइल अर्को प्रोग्राममा खुला छ","trash.read_only": "फाइल पढ्न मात्र मिल्ने छ",@@ -1272,5 +1273,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/pl.json b/src/Filee.App/Assets/i18n/pl.jsonindex c5b73494..467b62b0 100644--- a/src/Filee.App/Assets/i18n/pl.json+++ b/src/Filee.App/Assets/i18n/pl.json@@ -146,6 +146,7 @@"notice.original_kept": "Oryginał został zachowany, wynik zapisano jako kopię","notice.original_in_trash": "Oryginał jest w Koszu, wynik zachował własną nazwę","notice.original_unchanged": "Nie udało się go zmniejszyć, więc oryginał pozostał bez zmian",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "ten dysk nie ma Kosza","trash.in_use": "plik jest otwarty w innym programie","trash.read_only": "plik jest tylko do odczytu",@@ -1292,5 +1293,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/pt-BR.json b/src/Filee.App/Assets/i18n/pt-BR.jsonindex 4cb13284..8f38ff5d 100644--- a/src/Filee.App/Assets/i18n/pt-BR.json+++ b/src/Filee.App/Assets/i18n/pt-BR.json@@ -146,6 +146,7 @@"notice.original_kept": "O original foi mantido, o resultado foi salvo como cópia","notice.original_in_trash": "O original está na Lixeira, o resultado manteve o próprio nome","notice.original_unchanged": "Não foi possível deixá-lo menor, então o original ficou como estava",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "esta unidade não tem Lixeira","trash.in_use": "o arquivo está aberto em outro programa","trash.read_only": "o arquivo é somente leitura",@@ -1292,5 +1293,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/pt-PT.json b/src/Filee.App/Assets/i18n/pt-PT.jsonindex c5f5deba..b015434d 100644--- a/src/Filee.App/Assets/i18n/pt-PT.json+++ b/src/Filee.App/Assets/i18n/pt-PT.json@@ -146,6 +146,7 @@"notice.original_kept": "O original foi mantido e o resultado foi guardado como cópia","notice.original_in_trash": "O original está na Reciclagem ou no Lixo; o resultado manteve o seu próprio nome","notice.original_unchanged": "Não foi possível reduzir o tamanho, pelo que o original foi mantido sem alterações",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "esta unidade não tem Reciclagem nem Lixo","trash.in_use": "o ficheiro está aberto noutro programa","trash.read_only": "o ficheiro é só de leitura",@@ -1292,5 +1293,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/ru.json b/src/Filee.App/Assets/i18n/ru.jsonindex 911d72da..1f6a8694 100644--- a/src/Filee.App/Assets/i18n/ru.json+++ b/src/Filee.App/Assets/i18n/ru.json@@ -146,6 +146,7 @@"notice.original_kept": "Оригинал оставлен, результат сохранён как копия","notice.original_in_trash": "Оригинал в Корзине, результат сохранил своё имя","notice.original_unchanged": "Не удалось сделать его меньше, поэтому оригинал оставлен как есть",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "на этом диске нет Корзины","trash.in_use": "файл открыт в другой программе","trash.read_only": "файл только для чтения",@@ -1292,5 +1293,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/th.json b/src/Filee.App/Assets/i18n/th.jsonindex 42c9c874..4491d429 100644--- a/src/Filee.App/Assets/i18n/th.json+++ b/src/Filee.App/Assets/i18n/th.json@@ -140,6 +140,7 @@"notice.original_kept": "เก็บไฟล์ต้นฉบับไว้ และบันทึกผลลัพธ์เป็นสำเนา","notice.original_in_trash": "ไฟล์ต้นฉบับอยู่ในถังขยะ ผลลัพธ์ยังใช้ชื่อของตัวเอง","notice.original_unchanged": "ทำให้เล็กลงไม่ได้ จึงปล่อยไฟล์ต้นฉบับไว้ตามเดิม",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "ไดรฟ์นี้ไม่มีถังรีไซเคิล / ถังขยะ","trash.in_use": "ไฟล์เปิดอยู่ในโปรแกรมอื่น","trash.read_only": "ไฟล์เป็นแบบอ่านอย่างเดียว",@@ -1272,5 +1273,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/tr.json b/src/Filee.App/Assets/i18n/tr.jsonindex f7fa83e0..a5b61a4f 100644--- a/src/Filee.App/Assets/i18n/tr.json+++ b/src/Filee.App/Assets/i18n/tr.json@@ -140,6 +140,7 @@"notice.original_kept": "Özgün dosya korundu, sonuç kopya olarak kaydedildi","notice.original_in_trash": "Özgün dosya Geri Dönüşüm Kutusu'nda / Çöp Sepeti'nde; sonuç kendi adını korudu","notice.original_unchanged": "Küçültülemediği için özgün dosya olduğu gibi bırakıldı",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "bu sürücüde Geri Dönüşüm Kutusu / Çöp Sepeti yok","trash.in_use": "dosya başka bir programda açık","trash.read_only": "dosya salt okunur",@@ -1270,5 +1271,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.jsonindex 0986c0da..6f7d1c41 100644--- a/src/Filee.App/Assets/i18n/zh-CN.json+++ b/src/Filee.App/Assets/i18n/zh-CN.json@@ -146,6 +146,7 @@"notice.original_kept": "已保留原文件,结果另存为副本","notice.original_in_trash": "原文件已在回收站/废纸篓中,结果保留了自己的名称","notice.original_unchanged": "无法变小,因此保留原文件不变",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "此驱动器没有回收站/废纸篓","trash.in_use": "文件正在被其他程序使用","trash.read_only": "文件为只读",@@ -1292,5 +1293,7 @@"presets.copy_hint": "直接复制文件和文件夹,不转换格式。原件保留,重名时自动编号。","presets.copy_choose_folder": "请选择目标文件夹,或选择“每次询问”。","presets.copy_back": "复制到文件夹放在背面,请切换到背面后添加。",- "presets.copy_action": "操作"+ "presets.copy_action": "操作",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/Assets/i18n/zh-TW.json b/src/Filee.App/Assets/i18n/zh-TW.jsonindex 7dc954fc..18cd90f1 100644--- a/src/Filee.App/Assets/i18n/zh-TW.json+++ b/src/Filee.App/Assets/i18n/zh-TW.json@@ -146,6 +146,7 @@"notice.original_kept": "已保留原始檔案,結果另存為副本","notice.original_in_trash": "原始檔案已在資源回收筒/垃圾桶中,結果保留了自己的名稱","notice.original_unchanged": "無法變小,因此保留原始檔案不變",+ "notice.move_original_kept": "Copied, but the original couldn't be removed","trash.no_recycle_bin": "此磁碟機沒有資源回收筒/垃圾桶","trash.in_use": "檔案正由其他程式開啟","trash.read_only": "檔案為唯讀",@@ -1292,5 +1293,7 @@"presets.copy_hint": "Copy files and folders without conversion. Originals stay where they are; existing names get a number.","presets.copy_choose_folder": "Choose a destination folder, or Ask every time.","presets.copy_back": "Copy to folder belongs on the back face. Switch to Back to add it.",- "presets.copy_action": "Action"+ "presets.copy_action": "Action",+ "presets.move_to_folder": "Move to folder",+ "presets.move_hint": "Move files and folders without conversion. They are gone from where they were once they have arrived; existing names get a number."}diff --git a/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs b/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.csindex e6d9e590..0ae6e98e 100644--- a/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs@@ -900,6 +900,6 @@ public sealed partial class ToolbarPageViewModel : ObservableObject, IDisposableprivate string? Caption(Preset p) =>p.IsGroup ? _loc.Format("donut.group_caption", p.SubPresetIds.Count)- : p.IsCopyToFolder ? _loc["presets.copy_to_folder"]+ : p.IsCopyToFolder ? _loc[p.Output.MoveInsteadOfCopy ? "presets.move_to_folder" : "presets.copy_to_folder"]: p.TargetFormat == BuiltInData.SameAsSource ? _loc["donut.same_format"] : FormatLabels.NameOf(_loc, p.TargetFormat);}diff --git a/src/Filee.App/ViewModels/PresetEditorViewModel.cs b/src/Filee.App/ViewModels/PresetEditorViewModel.csindex 916946e8..aae80918 100644--- a/src/Filee.App/ViewModels/PresetEditorViewModel.cs+++ b/src/Filee.App/ViewModels/PresetEditorViewModel.cs@@ -234,6 +234,7 @@ public sealed partial class PresetEditorViewModel : ObservableObject_keepDates = _edit.Output.KeepDates;_zipResult = _edit.Output.ZipResult;_replaceOriginal = _edit.Output.ReplaceOriginal;+ _moveInsteadOfCopy = _edit.Output.MoveInsteadOfCopy;}public string PresetId => _original.Id;@@ -566,6 +567,26 @@ public sealed partial class PresetEditorViewModel : ObservableObject[ObservableProperty] private bool _zipResult;/// <summary>The result takes the original's place, which goes to the Recycle Bin / Trash (OutputRule.ReplaceOriginal).</summary>[ObservableProperty] private bool _replaceOriginal;+ /// <summary>Copy to folder: the files are moved instead of copied (OutputRule.MoveInsteadOfCopy, #856).</summary>+ [ObservableProperty, NotifyPropertyChangedFor(nameof(CopyHint), nameof(CopyAction))]+ private bool _moveInsteadOfCopy;++ /// <summary>Copy to folder's Action: copy (the default) or move.</summary>+ public IReadOnlyList<Choice<bool>> CopyActions =>+ [new(false, _loc["presets.copy_to_folder"]), new(true, _loc["presets.move_to_folder"])];++ public Choice<bool> CopyAction+ {+ get => CopyActions[MoveInsteadOfCopy ? 1 : 0];+ set+ {+ if (value is not null)+ MoveInsteadOfCopy = value.Value;+ }+ }++ /// <summary>What Copy to folder does with the originals, as the box below it is set.</summary>+ public string CopyHint => _loc[MoveInsteadOfCopy ? "presets.move_hint" : "presets.copy_hint"];[ObservableProperty] private Choice<MediaQuality> _mediaQuality;[ObservableProperty] private Choice<int> _maxHeight;[ObservableProperty] private Choice<int> _audioBitrate;@@ -934,6 +955,7 @@ public sealed partial class PresetEditorViewModel : ObservableObject// Only for geospatial targets, where it is offered: a box ticked for Shapefile must not zip a later PNG.output.ZipResult = ShowZipResult && ZipResult;output.ReplaceOriginal = !IsCopyToFolder && ReplaceOriginal;+ output.MoveInsteadOfCopy = IsCopyToFolder && MoveInsteadOfCopy;return true;}diff --git a/src/Filee.App/ViewModels/PresetFormatTip.cs b/src/Filee.App/ViewModels/PresetFormatTip.csindex fd837976..5a0af463 100644--- a/src/Filee.App/ViewModels/PresetFormatTip.cs+++ b/src/Filee.App/ViewModels/PresetFormatTip.cs@@ -75,7 +75,7 @@ public sealed partial class PresetFormatTip({Title = loc.DisplayName(preset);AnyFile = loc["toolbar.chip_tip.any_file"];- MakesBefore = loc["presets.copy_hint"];+ MakesBefore = loc[preset.Output.MoveInsteadOfCopy ? "presets.move_hint" : "presets.copy_hint"];return;}diff --git a/src/Filee.App/ViewModels/RadialViewModel.cs b/src/Filee.App/ViewModels/RadialViewModel.csindex 2ecd925d..85df52da 100644--- a/src/Filee.App/ViewModels/RadialViewModel.cs+++ b/src/Filee.App/ViewModels/RadialViewModel.cs@@ -243,7 +243,7 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,// On a group's ring the group's name gives the context: "Rotate" → Left / Right / 180°.Label = caption ? loc.DonutName(p) : loc.RingName(p),Caption = !caption ? null- : p.IsCopyToFolder ? loc["presets.copy_to_folder"]+ : p.IsCopyToFolder ? loc[p.Output.MoveInsteadOfCopy ? "presets.move_to_folder" : "presets.copy_to_folder"]: p.TargetFormat == BuiltInData.SameAsSource? string.Join("/", formats.Select(f => f.DisplayName).Take(2)): FormatLabels.NameOf(loc, p.TargetFormat),diff --git a/src/Filee.App/Views/PresetEditorView.axaml b/src/Filee.App/Views/PresetEditorView.axamlindex b462ac2b..865647ea 100644--- a/src/Filee.App/Views/PresetEditorView.axaml+++ b/src/Filee.App/Views/PresetEditorView.axaml@@ -36,8 +36,10 @@<StackPanel Grid.Column="2"><TextBlock Classes="label" Text="{DynamicResource presets.target}" IsVisible="{Binding ShowConversionOutput}" /><TextBlock Classes="label" Text="{DynamicResource presets.copy_action}" IsVisible="{Binding IsCopyToFolder}" />+ <ComboBox x:Name="CopyActionBox" ItemsSource="{Binding CopyActions}" SelectedItem="{Binding CopyAction}" IsVisible="{Binding IsCopyToFolder}"+ HorizontalAlignment="Stretch" AutomationProperties.Name="{DynamicResource presets.copy_action}" /><ComboBox x:Name="TargetBox" Classes="targets" ItemsSource="{Binding Targets}" SelectedItem="{Binding Target}"- IsEnabled="{Binding CanChangeTarget}"+ IsEnabled="{Binding CanChangeTarget}" IsVisible="{Binding !IsCopyToFolder}"HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" MaxDropDownHeight="420" AutomationProperties.Name="{DynamicResource presets.target}"><ComboBox.ItemTemplate><DataTemplate x:DataType="vm:IChoice">@@ -511,7 +513,7 @@</StackPanel></Border>- <TextBlock Text="{DynamicResource presets.copy_hint}" IsVisible="{Binding IsCopyToFolder}" TextWrapping="Wrap" />+ <TextBlock Text="{Binding CopyHint}" IsVisible="{Binding IsCopyToFolder}" TextWrapping="Wrap" /><!-- Output --><Border Classes="card" Padding="14">diff --git a/src/Filee.Core/Conversion/JobQueue.Copy.cs b/src/Filee.Core/Conversion/JobQueue.Copy.csindex 3ad452a7..73fefd14 100644--- a/src/Filee.Core/Conversion/JobQueue.Copy.cs+++ b/src/Filee.Core/Conversion/JobQueue.Copy.cs@@ -12,7 +12,19 @@ public sealed partial class JobQueueNotify(job);try{- var result = await FolderCopy.CopyAsync(file.SourcePath, job.Preset.Output, job.CancellationToken);+ string? result;+ // A file from a browser has no original to remove: it is saved as a copying slice saves it.+ if (job.Preset.Output.MoveInsteadOfCopy && !file.NeedsFetch)+ {+ (result, var kept) = await FolderCopy.MoveAsync(file.SourcePath, job.Preset.Output, job.CancellationToken);+ if (kept is not null)+ {+ file.NoticeKey = "notice.move_original_kept";+ file.NoticeDetail = kept;+ }+ }+ else+ result = await FolderCopy.CopyAsync(file.SourcePath, job.Preset.Output, job.CancellationToken);if (result is not null)file.Outputs.Add(result);file.Progress = 1;diff --git a/src/Filee.Core/Presets/FolderCopy.cs b/src/Filee.Core/Presets/FolderCopy.csindex bf44f7ee..eef38fcb 100644--- a/src/Filee.Core/Presets/FolderCopy.cs+++ b/src/Filee.Core/Presets/FolderCopy.cs@@ -2,17 +2,59 @@ using Filee.Core.Platform;namespace Filee.Core.Presets;-/// <summary>Byte-preserving copies, published without overwriting any existing file or folder.</summary>+/// <summary>Byte-preserving copies and moves, published without overwriting any existing file or folder.</summary>public static class FolderCopy{private const string WorkPrefix = ".filee-copy-";+ /// <summary>Whether two folders are on the same volume, where a move is a rename. Tests replace it.</summary>+ internal static Func<string, string, bool> SameVolume { get; set; } = (a, b) =>+ VolumeOf(a) is { } volume && FileSystemPaths.Comparer.Equals(volume, VolumeOf(b));+/// <summary>Watchers ignore unpublished copies, including files inside their temporary directories.</summary>public static bool IsWorkPath(string path) => path.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).Any(part => part.StartsWith(WorkPrefix, StringComparison.Ordinal) && part.EndsWith(".tmp", StringComparison.Ordinal));/// <returns>The new path, or null when the source is already in the destination folder.</returns>public static async Task<string?> CopyAsync(string source, OutputRule rule, CancellationToken cancellationToken)+ {+ if (Prepare(ref source, rule) is not { } target)+ return null;+ return await CopyThenPublishAsync(source, target, verify: false, cancellationToken);+ }++ /// <summary>+ /// Moves a file or folder into the rule's folder (#856). On the same volume it is a rename. On another one it is+ /// copied under a temporary name, checked to be complete, published, and only then is the original deleted.+ /// </summary>+ /// <returns>+ /// The new path (null when the source is already in the destination folder), and why the original is still there+ /// when it couldn't be deleted after a complete copy (null when it is gone).+ /// </returns>+ public static async Task<(string? Path, string? OriginalKept)> MoveAsync(string source, OutputRule rule, CancellationToken cancellationToken)+ {+ if (Prepare(ref source, rule) is not { } target)+ return (null, null);+ if (SameVolume(Path.GetDirectoryName(source)!, target.Folder) && Rename(source, target, cancellationToken) is { } renamed)+ return (renamed, null);+ var copied = await CopyThenPublishAsync(source, target, verify: true, cancellationToken);+ try+ {+ if (target.Directory) Directory.Delete(source, recursive: true);+ else File.Delete(source);+ return (copied, null);+ }+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)+ {+ // The copy is whole and published: nothing is lost, the original (or what is left of a folder) stays.+ return (copied, ex.Message);+ }+ }++ /// <summary>Where a source goes, or null when it is already in the destination folder.</summary>+ private sealed record Target(string Folder, string Name, bool Directory);++ private static Target? Prepare(ref string source, OutputRule rule){if (rule.AskEveryTime || rule.Location != OutputLocation.CustomFolder || string.IsNullOrWhiteSpace(rule.CustomFolder))throw new IOException("Choose a destination folder for Copy to folder.");@@ -27,26 +69,61 @@ public static class FolderCopy|| destination.StartsWith(source + Path.DirectorySeparatorChar, FileSystemPaths.Comparison)))throw new IOException("A folder cannot be copied into itself or one of its subfolders.");var name = rule.ConfirmedPath is { } chosen ? Path.GetFileName(chosen) : Path.GetFileName(source);- var stage = Path.Combine(destination, WorkPrefix + Guid.NewGuid().ToString("N") + ".tmp");+ return new Target(destination, name, directory);+ }++ /// <summary>The free name for the n-th try: the name itself, then "name (2)", "name (3)" ...</summary>+ private static string Candidate(Target target, int n)+ {+ var extension = target.Directory ? "" : Path.GetExtension(target.Name);+ var stem = target.Directory ? target.Name : Path.GetFileNameWithoutExtension(target.Name);+ return Path.Combine(target.Folder, n == 1 ? target.Name : $"{stem} ({n}){extension}");+ }++ /// <summary>+ /// Renames the source to the first free name. Null when the volume can't rename it (a folder that turns out to be+ /// on another volume): the caller copies instead. Any other failure leaves the source where it was.+ /// </summary>+ private static string? Rename(string source, Target target, CancellationToken cancellationToken)+ {+ for (var n = 1; ; n++)+ {+ cancellationToken.ThrowIfCancellationRequested();+ var path = Candidate(target, n);+ try+ {+ if (target.Directory) Directory.Move(source, path);+ else File.Move(source, path, overwrite: false);+ return path;+ }+ catch (IOException) when (File.Exists(path) || Directory.Exists(path)) { }+ catch (IOException) when (target.Directory && Directory.Exists(source)) { return null; }+ }+ }++ private static async Task<string> CopyThenPublishAsync(string source, Target target, bool verify, CancellationToken cancellationToken)+ {+ var stage = Path.Combine(target.Folder, WorkPrefix + Guid.NewGuid().ToString("N") + ".tmp");try{- if (directory)+ if (target.Directory)await CopyDirectoryAsync(source, stage, cancellationToken);elseawait CopyFileAsync(source, stage, cancellationToken);- var extension = directory ? "" : Path.GetExtension(name);- var stem = directory ? name : Path.GetFileNameWithoutExtension(name);+ // A move deletes the original next: only after every byte has arrived.+ if (verify && SizeOf(stage) != SizeOf(source))+ throw new IOException("The copy is incomplete, so the original was kept: " + source);for (var n = 1; ; n++){cancellationToken.ThrowIfCancellationRequested();- var target = Path.Combine(destination, n == 1 ? name : $"{stem} ({n}){extension}");+ var path = Candidate(target, n);try{- if (directory) Directory.Move(stage, target);- else File.Move(stage, target, overwrite: false);- return target;+ if (target.Directory) Directory.Move(stage, path);+ else File.Move(stage, path, overwrite: false);+ return path;}- catch (IOException) when (File.Exists(target) || Directory.Exists(target)) { }+ catch (IOException) when (File.Exists(path) || Directory.Exists(path)) { }}}finally@@ -75,4 +152,29 @@ public static class FolderCopyforeach (var folder in Directory.EnumerateDirectories(source))await CopyDirectoryAsync(folder, Path.Combine(target, Path.GetFileName(folder)), cancellationToken);}++ /// <summary>Bytes in a file, or in every file of a folder and its subfolders.</summary>+ private static long SizeOf(string path) => Directory.Exists(path)+ ? Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories).Sum(f => new FileInfo(f).Length)+ : new FileInfo(path).Length;++ /// <summary>The mount point (or drive) a path is on: the longest volume root it starts with.</summary>+ private static string? VolumeOf(string path)+ {+ path = Path.GetFullPath(path);+ string? best = null;+ try+ {+ foreach (var drive in DriveInfo.GetDrives())+ {+ var root = drive.RootDirectory.FullName;+ var prefix = Path.EndsInDirectorySeparator(root) ? root : root + Path.DirectorySeparatorChar;+ if ((FileSystemPaths.Comparer.Equals(path, root) || path.StartsWith(prefix, FileSystemPaths.Comparison))+ && (best is null || root.Length > best.Length))+ best = root;+ }+ }+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) { return null; }+ return best;+ }}diff --git a/src/Filee.Core/Presets/OutputRule.cs b/src/Filee.Core/Presets/OutputRule.csindex ae79a68b..1f9040d3 100644--- a/src/Filee.Core/Presets/OutputRule.cs+++ b/src/Filee.Core/Presets/OutputRule.cs@@ -115,6 +115,13 @@ public sealed class OutputRule/// </summary>public bool ReplaceOriginal { get; set; }+ /// <summary>+ /// Copy to folder only (#856): the files are moved into <see cref="CustomFolder"/> instead of copied, so they are+ /// gone from where they were. Off by default. An original is removed only once its copy is complete; files from a+ /// browser have no original and are saved as when copying. A Filee from before it ignores it and copies.+ /// </summary>+ public bool MoveInsteadOfCopy { get; set; }+public OutputRule Clone(){var clone = (OutputRule)MemberwiseClone();diff --git a/tests/Filee.App.Tests/FolderCopyTests.cs b/tests/Filee.App.Tests/FolderCopyTests.csindex f6c04bf5..f86268ad 100644--- a/tests/Filee.App.Tests/FolderCopyTests.cs+++ b/tests/Filee.App.Tests/FolderCopyTests.cs@@ -1,6 +1,7 @@using Avalonia;using Avalonia.Controls;using Avalonia.Headless.XUnit;+using Avalonia.VisualTree;using Filee.App.Controls;using Filee.App.Services;using Filee.App.ViewModels;@@ -135,5 +136,69 @@ public class FolderCopyTestsforeach (var p in copies.Append(group)) store.Presets.Remove(p);}}-}+ [AvaloniaFact]+ public void Move_action_changes_the_hint_saves_with_the_preset_and_names_the_slice()+ {+ TestServices.EnsureInitialized("en");+ var store = AppHost.Get<UserDataStore>();+ var loc = AppHost.Get<ILocalizer>();+ var preset = Copy("Projects", "C:\\Projects");+ var editor = new PresetEditorViewModel(preset, loc);+ Assert.False(editor.MoveInsteadOfCopy);+ Assert.Equal(loc["presets.copy_hint"], editor.CopyHint);+ var window = new PresetEditorWindow { DataContext = editor };+ try+ {+ window.Show(); RenderTests.Pump();+ // Chosen as the user does, in the Action box.+ Assert.Equal([loc["presets.copy_to_folder"], loc["presets.move_to_folder"]], editor.CopyActions.Select(c => c.Label));+ Assert.Equal(loc["presets.copy_to_folder"], editor.CopyAction.Label);+ editor.CopyAction = editor.CopyActions[1];+ RenderTests.Pump();+ Assert.True(editor.MoveInsteadOfCopy);+ var boxes = window.GetVisualDescendants().OfType<ComboBox>().ToList();+ Assert.True(boxes.Single(b => b.Name == "CopyActionBox").IsEffectivelyVisible);+ Assert.False(boxes.Single(b => b.Name == "TargetBox").IsEffectivelyVisible);+ Assert.Equal(loc["presets.move_hint"], editor.CopyHint);+ RenderTests.Save(window, "copy-folder-move-editor-en.png");+ Assert.True(editor.Apply());+ Assert.True(preset.Output.MoveInsteadOfCopy);+ Assert.True(new PresetEditorViewModel(preset, loc).MoveInsteadOfCopy);+ }+ finally { window.Close(); }++ // A conversion preset never saves it, even when its editor's value is set.+ var convert = new Preset { Name = "PNG", TargetFormat = "png" };+ var other = new PresetEditorViewModel(convert, loc) { MoveInsteadOfCopy = true };+ Assert.True(other.Apply());+ Assert.False(convert.Output.MoveInsteadOfCopy);++ var copy = Copy("References", "C:\\References");+ var group = new Preset { Kind = PresetKind.Group, TargetFormat = Preset.GroupTarget, Name = "Folders", SubPresetIds = [preset.Id, copy.Id] };+ var profile = store.Profiles.Single(p => p.Id == "images");+ var before = profile.BackPresetIds;+ var motion = Motion.Enabled;+ Window? donutWindow = null;+ try+ {+ foreach (var p in new[] { preset, copy, group }) store.Presets.Add(p);+ profile.BackPresetIds = [preset.Id, copy.Id];+ var radial = new RadialViewModel(store, loc, AppHost.Get<PresetAvailability>());+ radial.Load(["picture.png"], clickMode: true, backFace: true);+ Assert.Equal(loc["presets.move_to_folder"], radial.Items.Single(i => i.Id == preset.Id).Caption);+ Assert.Equal(loc["presets.copy_to_folder"], radial.Items.Single(i => i.Id == copy.Id).Caption);+ Motion.Set(false);+ var donut = new DonutMenu { Items = radial.Items, CenterTitle = "picture.png", OuterRadius = 160 };+ donutWindow = new Window { Width = 420, Height = 420, Content = donut };+ donutWindow.Show(); RenderTests.Pump();+ RenderTests.Save(donutWindow, "copy-folder-move-donut-en.png");+ }+ finally+ {+ donutWindow?.Close(); Motion.Set(motion);+ profile.BackPresetIds = before;+ foreach (var p in new[] { preset, copy, group }) store.Presets.Remove(p);+ }+ }+}diff --git a/tests/Filee.Core.Tests/FolderCopyTests.cs b/tests/Filee.Core.Tests/FolderCopyTests.csindex e7decb2c..0b0919c2 100644--- a/tests/Filee.Core.Tests/FolderCopyTests.cs+++ b/tests/Filee.Core.Tests/FolderCopyTests.cs@@ -140,4 +140,189 @@ public class FolderCopyTestsawait Assert.ThrowsAnyAsync<OperationCanceledException>(() => FolderCopy.CopyAsync(source.File("a.txt"), Copy(target.Path).Output, cancel.Token));Assert.Empty(Directory.GetFileSystemEntries(target.Path));}++ private static Preset Move(string folder)+ {+ var preset = Copy(folder);+ preset.Output.MoveInsteadOfCopy = true;+ return preset;+ }++ /// <summary>Runs <paramref name="body"/> as if every destination were on another volume than its source.</summary>+ private static async Task AcrossVolumes(Func<Task> body)+ {+ var sameVolume = FolderCopy.SameVolume;+ FolderCopy.SameVolume = (_, _) => false;+ try { await body(); }+ finally { FolderCopy.SameVolume = sameVolume; }+ }++ [Fact]+ public void Move_is_off_by_default_and_survives_a_clone()+ {+ Assert.False(Copy("x").Output.MoveInsteadOfCopy);+ Assert.True(Move("x").Clone().Output.MoveInsteadOfCopy);+ }++ [Fact]+ public async Task Move_on_the_same_volume_renames_the_file_with_its_bytes_and_date()+ {+ using var source = new TempDir(); using var target = new TempDir();+ var file = source.File("report.xyz");+ var bytes = Enumerable.Range(0, 1000).Select(i => (byte)i).ToArray();+ File.WriteAllBytes(file, bytes);+ var stamp = new DateTime(2024, 5, 1, 12, 0, 0, DateTimeKind.Utc);+ File.SetLastWriteTimeUtc(file, stamp);+ var job = await Run([file], Move(target.Path));+ Assert.Equal(JobState.Completed, job.State);+ var moved = Assert.Single(job.Outputs);+ Assert.Equal(Path.Combine(target.Path, "report.xyz"), moved);+ Assert.Equal(bytes, File.ReadAllBytes(moved));+ Assert.Equal(stamp, File.GetLastWriteTimeUtc(moved));+ Assert.False(File.Exists(file));+ Assert.Null(job.Files.Single().NoticeKey);+ }++ [Fact]+ public async Task Move_across_volumes_copies_checks_then_deletes_files_and_folders() => await AcrossVolumes(async () =>+ {+ using var source = new TempDir(); using var target = new TempDir();+ var folder = Path.Combine(source.Path, "icons.v1");+ Directory.CreateDirectory(Path.Combine(folder, "empty"));+ File.WriteAllText(Path.Combine(folder, "a.svg"), "svg bytes");+ var file = source.File("photo.xyz", "photo bytes");+ var job = await Run([folder, file], Move(target.Path));+ Assert.Equal(JobState.Completed, job.State);+ Assert.Equal("svg bytes", File.ReadAllText(Path.Combine(target.Path, "icons.v1", "a.svg")));+ Assert.True(Directory.Exists(Path.Combine(target.Path, "icons.v1", "empty")));+ Assert.Equal("photo bytes", File.ReadAllText(Path.Combine(target.Path, "photo.xyz")));+ Assert.False(Directory.Exists(folder)); Assert.False(File.Exists(file));+ // Nothing unpublished is left behind.+ Assert.DoesNotContain(Directory.GetFileSystemEntries(target.Path), FolderCopy.IsWorkPath);+ });++ [Fact]+ public async Task Move_of_a_folder_on_the_same_volume_is_a_rename()+ {+ using var source = new TempDir(); using var target = new TempDir();+ var folder = Path.Combine(source.Path, "project");+ Directory.CreateDirectory(Path.Combine(folder, "sub"));+ File.WriteAllText(Path.Combine(folder, "sub", "a.txt"), "a");+ var job = await Run([folder], Move(target.Path));+ Assert.Equal(Path.Combine(target.Path, "project"), Assert.Single(job.Outputs));+ Assert.Equal("a", File.ReadAllText(Path.Combine(target.Path, "project", "sub", "a.txt")));+ Assert.False(Directory.Exists(folder));+ }++ [Theory]+ [InlineData(true)]+ [InlineData(false)]+ public async Task Move_clash_is_numbered_and_never_overwrites(bool sameVolume)+ {+ async Task Body()+ {+ using var source = new TempDir(); using var target = new TempDir();+ var file = source.File("a.txt", "new");+ var existing = target.File("a.txt", "keep");+ var preset = Move(target.Path);+ preset.Output.Conflict = ConflictPolicy.Overwrite;+ var job = await Run([file], preset);+ Assert.Equal(Path.Combine(target.Path, "a (2).txt"), Assert.Single(job.Outputs));+ Assert.Equal("keep", File.ReadAllText(existing));+ Assert.Equal("new", File.ReadAllText(job.Outputs.Single()));+ Assert.False(File.Exists(file));+ }+ if (sameVolume) await Body(); else await AcrossVolumes(Body);+ }++ [Fact]+ public async Task Move_into_the_files_own_folder_does_nothing()+ {+ using var source = new TempDir(); var file = source.File("a.txt");+ var job = await Run([file], Move(source.Path));+ Assert.Equal(FileState.Skipped, Assert.Single(job.Files).State);+ Assert.Equal([file], Directory.GetFiles(source.Path));+ }++ [Fact]+ public async Task Failed_moves_leave_the_original_where_it_was()+ {+ using var source = new TempDir();+ var file = source.File("a.txt", "keep");+ var missing = Path.Combine(source.Path, "unplugged", "target");+ var job = await Run([file], Move(missing));+ Assert.Equal(JobState.Failed, job.State);+ Assert.Contains("destination folder", Assert.Single(job.Files).ErrorDetail);+ Assert.False(Directory.Exists(Path.GetDirectoryName(missing)));+ Assert.Equal("keep", File.ReadAllText(file));++ var child = Path.Combine(source.Path, "child"); Directory.CreateDirectory(child);+ var into = await Run([source.Path], Move(child));+ Assert.Contains("itself", Assert.Single(into.Files).ErrorDetail);+ Assert.Equal("keep", File.ReadAllText(file));+ Assert.Empty(Directory.GetFileSystemEntries(child));+ }++ [Fact]+ public async Task Cancelled_move_across_volumes_keeps_the_original_and_leaves_no_partial_output() => await AcrossVolumes(async () =>+ {+ using var source = new TempDir(); using var target = new TempDir();+ var file = source.File("a.txt", "keep");+ using var cancel = new CancellationTokenSource(); cancel.Cancel();+ await Assert.ThrowsAnyAsync<OperationCanceledException>(() => FolderCopy.MoveAsync(file, Move(target.Path).Output, cancel.Token));+ Assert.Equal("keep", File.ReadAllText(file));+ Assert.Empty(Directory.GetFileSystemEntries(target.Path));+ });++ [Fact]+ public async Task Original_that_cannot_be_deleted_keeps_the_complete_copy_with_a_notice() => await AcrossVolumes(async () =>+ {+ using var source = new TempDir(); using var target = new TempDir();+ var folder = Path.Combine(source.Path, "locked"); Directory.CreateDirectory(folder);+ var file = Path.Combine(folder, "a.txt"); File.WriteAllText(file, "bytes");+ // A file that can't be deleted: read-only on Windows, in a folder without write permission elsewhere.+ if (OperatingSystem.IsWindows()) File.SetAttributes(file, FileAttributes.ReadOnly);+ else File.SetUnixFileMode(folder, UnixFileMode.UserRead | UnixFileMode.UserExecute);+ try+ {+ var job = await Run([file], Move(target.Path));+ var result = Assert.Single(job.Files);+ Assert.Equal(FileState.Done, result.State);+ Assert.Equal("notice.move_original_kept", result.NoticeKey);+ Assert.False(string.IsNullOrWhiteSpace(result.NoticeDetail));+ Assert.Equal("bytes", File.ReadAllText(Assert.Single(job.Outputs)));+ Assert.Equal("bytes", File.ReadAllText(file));+ }+ finally+ {+ if (OperatingSystem.IsWindows()) File.SetAttributes(file, FileAttributes.Normal);+ else File.SetUnixFileMode(folder, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);+ }+ });++ [Fact]+ public async Task Browser_download_on_a_moving_slice_is_saved_as_a_copy_would_be()+ {+ using var target = new TempDir(); using var work = new TempDir();+ byte[] bytes = [137, 80, 78, 71, 13, 10, 26, 10, 1, 2, 3, 4];+ using var downloader = new WebDownloader(new Response(bytes));+ using var drop = new WebDrop([WebDropItem.FromAddress("picture.png", new Uri("https://example.test/picture.png"))], work.Path);+ var fetcher = drop.CreateFetcher(new WebDropOptions(target.Path, true), downloader);+ var job = await Run(drop.Placeholders, Move(target.Path), fetcher);+ Assert.Equal(JobState.Completed, job.State);+ Assert.Equal(bytes, File.ReadAllBytes(Assert.Single(job.Outputs)));+ Assert.False(Directory.Exists(drop.WorkFolder));+ Assert.Single(Directory.GetFiles(target.Path));+ }++ [Fact]+ public async Task Ask_every_time_moves_the_file_under_the_chosen_name()+ {+ using var source = new TempDir(); using var target = new TempDir();+ var file = source.File("a.txt", "bytes");+ var preset = AskedLocation.ForFile(Move(target.Path), Path.Combine(target.Path, "renamed.txt"));+ var job = await Run([file], preset);+ Assert.Equal(Path.Combine(target.Path, "renamed.txt"), Assert.Single(job.Outputs));+ Assert.False(File.Exists(file));+ }}