Удаление файлов/папок с зарезервированными именами
- операции с файлами/папками с зарезервированными именами. - обращение к разделу напрямую через точку монтирования. А также:
- отключает парсинг большинства спецсимволов. Цитата:
For file I/O, the "\\?\" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system. For example, if the file system supports large paths and file names, you can exceed the MAX_PATH limits that are otherwise enforced by the Windows APIs.
… Because it turns off automatic expansion of the path string, the "\\?\" prefix also allows the use of ".." and "." in the path names, which can be useful if you are attempting to perform operations on a file with these otherwise reserved relative path specifiers as part of the fully qualified path.
Цитата:
The "\\.\" prefix will access the Win32 device namespace instead of the Win32 file namespace. This is how access to physical disks and volumes is accomplished directly, without going through the file system, if the API supports this type of access. You can access many devices other than disks this way (using the CreateFile and DefineDosDevice functions, for example).
… Another example of using the Win32 device namespace is using the CreateFile function with "\\.\PhysicalDiskX" (where X is a valid integer value) or "\\.\CdRomX". This allows you to access those devices directly, bypassing the file system. This works because these device names are created by the system as these devices are enumerated, and some drivers will also create other aliases in the system. For example, the device driver that implements the name "C:\" has its own namespace that also happens to be the file system. 1) Обращение к разделу напрямую через точку монтирования:
Список таких точек можно получить штатной утилитой MOUNTVOL.exe без параметров. Примеры также можете почитать в статьях Криса Касперского - один, два. И в этой теме: Программно скрыть каталог или жёсткий диск 2) Создание виртуального жесткого диска VHD и подключение его как пустой папки через точку монтирования.
3) Удаление рекурсивно всех папок (в т.ч. с некорректными именами, например концевым пробелом, точками, названиями системных устройств). Каждое удаление сопровождается обязательным подтверждением действия от пользователя. Бат-файл поместить в папку, в которой нужно удалить все каталоги. Из нее и запускать.
Path (computing) - Wikipedia MSDN - Naming Files, Paths, and Namespaces MSDN - Naming a Volume wiki.drweb.com/index.php/Каталог_E2E2~1 MSKB - Невозможно удалить файл или папку в томе с файловой системой NTFS MSKB - Удаление файлов с зарезервированными именами в Windows XP |
Всего комментариев 0
Комментарии