Relevant

A New Template for Joomla!

 

Delete Folder when Path Too Long

Sometimes you will try to delete a folder and get the error: PATH TOO LONG. This happens when there are files inside the folder where the full path is greater than 256 characters.

Options:

  1. Delete the folder by using its 8.3 short name. You can use dir /x <full path to file> to determine this
  2. Sometimes even the 8.3 short name is too long. Start renaming parent folders until the path is short enough.
  3. Use the following script to delete the folder

Script to Delete Folder when Path Too Long

This script will delete a folder even if the path is too long.

The script requires Robocopy, which comes with Vista and Windows 7, or you can download the exe for XP and Server 2003 and save it in C:\Windows\System32.

Save the script as DelFolder.bat, in C:\Windows\System32

Usage: DelFolder <full path to folder you wish to delete>

@echo off
if {%1}=={} @echo Syntax: DelFolder FolderPath&goto :EOF
if not exist %1 @echo Syntax: DelFolder FolderPath - %1 NOT found.&goto :EOF
setlocal
set folder=%1
set MT="%TEMP%\DelFolder_%RANDOM%"
MD %MT%
RoboCopy %MT% %folder% /MIR
RD /S /Q %MT%
RD /S /Q %folder%
endlocal

Source: http://www.windowsitpro.com/article/tips/jsi-tip-9651-how-can-i-delete-a-folder-that-returns-path-too-long-.aspx