Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  | Правила  

Компьютерный форум OSzone.net » Компьютеры + Интернет » Хочу все знать » проблема удаления множества файлов с длинным путем

Ответить
Настройки темы
проблема удаления множества файлов с длинным путем

Пользователь


Сообщения: 99
Благодарности: 0

Профиль | Отправить PM | Цитировать


Добрый день!
нужно на файловом хранилище (огромная куча папок и подпапок) удалить все файлы определенного типа
вот пример того что забиваю в командную строку
cd /d C:\files
del /s /q *.doc
но на некоторых файлах с длинным путем, вся операция прекращается и дальше не идет, пока проблемный файл не будет удален вручную.
но таких длинных файлов очень много и вручную уже не поудаляешь.
есть ли какое-нибудь решение?

Отправлено: 17:46, 12-01-2015

 
MKN MKN вне форума

Ветеран


Сообщения: 2371
Благодарности: 563

Профиль | Отправить PM | Цитировать


kupall,
попробуй работать с короткими именами (преобразуй длинные)

Отправлено: 18:03, 12-01-2015 | #2



Для отключения данного рекламного блока вам необходимо зарегистрироваться или войти с учетной записью социальной сети.

Если же вы забыли свой пароль на форуме, то воспользуйтесь данной ссылкой для восстановления пароля.

mwz mwz вне форума

Аватара для mwz

Ушел из жизни


Сообщения: 8595
Благодарности: 2127

Профиль | Сайт | Отправить PM | Цитировать


kupall, а что,

cmd /c Del /S /Q /A \\.\C:\files\*.doc

(начало до Del – для возможности запуска команды не в окне CMD, а по Win+R, и в батнике не нужно. Ключ /A – для удаления в т.ч. скрытых файлов) тоже не работает?

-------
Mikhail Zhilin


Последний раз редактировалось mwz, 13-01-2015 в 00:44. Причина: В комментарии поправил Dir на правильное Del

Это сообщение посчитали полезным следующие участники:

Отправлено: 23:16, 12-01-2015 | #3


Пользователь


Сообщения: 99
Благодарности: 0

Профиль | Отправить PM | Цитировать


все равно не получилось, застревает на одном файле и прекращает операцию
а что означает выражение \\.\ а то нагуглить не получается

Последний раз редактировалось kupall, 13-01-2015 в 11:37.


Отправлено: 11:31, 13-01-2015 | #4


Ветеран


Сообщения: 27449
Благодарности: 8087

Профиль | Отправить PM | Цитировать


Цитата kupall:
а что означает выражение \\.\ а то нагуглить не получается »
Naming Files, Paths, and Namespaces (Windows):
Скрытый текст
Цитата:


Win32 Device Namespaces

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).

For example, if you want to open the system's serial communications port 1, you can use "COM1" in the call to the CreateFile function. This works because COM1–COM9 are part of the reserved names in the NT namespace, although using the "\\.\" prefix will also work with these device names. By comparison, if you have a 100 port serial expansion board installed and want to open COM56, you cannot open it using "COM56" because there is no predefined NT namespace for COM56. You will need to open it using "\\.\COM56" because "\\.\" goes directly to the device namespace without attempting to locate a predefined alias.

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.

APIs that go through the CreateFile function generally work with the "\\.\" prefix because CreateFile is the function used to open both files and devices, depending on the parameters you use.

If you're working with Windows API functions, you should use the "\\.\" prefix to access devices only and not files.

Most APIs won't support "\\.\"; only those that are designed to work with the device namespace will recognize it. Always check the reference topic for each API to be sure.

NT Namespaces

There are also APIs that allow the use of the NT namespace convention, but the Windows Object Manager makes that unnecessary in most cases. To illustrate, it is useful to browse the Windows namespaces in the system object browser using the Windows Sysinternals WinObj tool. When you run this tool, what you see is the NT namespace beginning at the root, or "\". The subfolder called "Global??" is where the Win32 namespace resides. Named device objects reside in the NT namespace within the "Device" subdirectory. Here you may also find Serial0 and Serial1, the device objects representing the first two COM ports if present on your system. A device object representing a volume would be something like "HarddiskVolume1", although the numeric suffix may vary. The name "DR0" under subdirectory "Harddisk0" is an example of the device object representing a disk, and so on.

To make these device objects accessible by Windows applications, the device drivers create a symbolic link (symlink) in the Win32 namespace, "Global??", to their respective device objects. For example, COM0 and COM1 under the "Global??" subdirectory are simply symlinks to Serial0 and Serial1, "C:" is a symlink to HarddiskVolume1, "Physicaldrive0" is a symlink to DR0, and so on. Without a symlink, a specified device "Xxx" will not be available to any Windows application using Win32 namespace conventions as described previously. However, a handle could be opened to that device using any APIs that support the NT namespace absolute path of the format "\Device\Xxx".

With the addition of multi-user support via Terminal Services and virtual machines, it has further become necessary to virtualize the system-wide root device within the Win32 namespace. This was accomplished by adding the symlink named "GLOBALROOT" to the Win32 namespace, which you can see in the "Global??" subdirectory of the WinObj browser tool previously discussed, and can access via the path "\\?\GLOBALROOT". This prefix ensures that the path following it looks in the true root path of the system object manager and not a session-dependent path.


Для общего обзора также имеет смысл: How NTFS Works: Local File Systems.

Отправлено: 12:26, 13-01-2015 | #5


Ветеран


Сообщения: 27449
Благодарности: 8087

Профиль | Отправить PM | Цитировать


kupall, я бы ещё попробовал volume'овский префикс \\?\<Volume GUID>\<Very long path>. Т.е., сначала определяете ссылку посредством «mountvol.exe»:
Код: Выделить весь код
mountvol.exe c: /l
Затем пробуете использовать её в виде:
Код: Выделить весь код
del /s /q /a "\\?\Volume{19a771ac-c879-11df-867c-806dbcd2696f}\files\*.doc"
Разумеется, вместо выделенного подставьте Volume GUID Вашего тома.

Отправлено: 12:41, 13-01-2015 | #6


(*.*)


Сообщения: 36564
Благодарности: 6696

Профиль | Сайт | Отправить PM | Цитировать


Вдобавок Как обойти ограничение на длину пути при создании или копировании файла (и удаления тоже)

-------
Канал Windows 11, etc | Чат @winsiders


Отправлено: 16:00, 13-01-2015 | #7


Ветеран


Сообщения: 27449
Благодарности: 8087

Профиль | Отправить PM | Цитировать


Vadikan, в данном случае проблема не в том, как сделать, а в том, как сделать массово. Так-то можно хоть subst пользовать для сокращения пути.

Отправлено: 17:08, 13-01-2015 | #8


Аватара для DJ Mogarych

fascinating rhythm


Moderator


Сообщения: 6627
Благодарности: 1529

Профиль | Отправить PM | Цитировать


Robocopy умеет работать со сверхдлинными путями файлов. Robocopy встроен во все более-менее свежие системы Windows.
Создайте пустую папку и синхронизируйте с той папкой, где файлы нужно удалить. (ключ, кажется, называется /MIR)

синтаксис

-------
Powershell 7.x | Powershell 5.1 | ffmpeg (docs)


Отправлено: 00:36, 14-01-2015 | #9


Ветеран


Сообщения: 27449
Благодарности: 8087

Профиль | Отправить PM | Цитировать


DJ Mogarych, мне что-то не удаётся составить корректный синтаксис с маской — удаляется всё, отсутствующее в назначении.

Отправлено: 02:10, 14-01-2015 | #10



Компьютерный форум OSzone.net » Компьютеры + Интернет » Хочу все знать » проблема удаления множества файлов с длинным путем

Участник сейчас на форуме Участник сейчас на форуме Участник вне форума Участник вне форума Автор темы Автор темы Шапка темы Сообщение прикреплено

Похожие темы
Название темы Автор Информация о форуме Ответов Последнее сообщение
Интерфейс - [решено] Упорядочение файлов в папке путем их перетаскивания Vadikan Microsoft Windows 7 60 21-04-2013 16:47
CMD/BAT - [решено] автоматизация удаления файлов их множества архивов CRi Скриптовые языки администрирования Windows 2 30-12-2012 00:01
Интерфейс - [решено] Проблема перемещения файлов и папок, путем перетаскивания davserg Microsoft Windows 7 8 19-10-2009 11:55
Проблема удаления временных файлов Интернета SAToNA Microsoft Windows 2000/XP 0 15-02-2006 07:31
Проблема с длинным именем домена Guest Сетевые технологии 2 12-10-2004 13:46




 
Переход