Windows Delete Folder '.'

3

I'm using UrbanCode Deploy for windows code deployments, and in my folder I've created a folder '.' . I've tried all the powershell remove-item commands and flags I can think of, I've tried robocopy move / purge copying it somewhere else, and run a chkdsk with no reported errors.

When I delete it manually I get 'Error 0x80070091: The directory is not empty'.

When I try and delete it through powershell I get 'Get-ChildItem : The path is not of a legal form'

If I open the '.' folder, it's as if I did 'ls -l ./'. If I go one deeper I get an error 'This file path refers to a location that is unavailable.'

Any ideas how to delete this folder?

powershell
asked on Server Fault Jan 13, 2017 by pcort

3 Answers

1

Ended up finding a solution here, https://superuser.com/questions/78434/how-to-delete-directories-with-path-names-too-long-for-normal-delete

By opening up the parent directory in 7zip I was able to remove the directory by using shift+Delete on the folder. It looks like this is able to remove recursively created folders that are too long for file explorer to handle as well as illegal path names.

Thanks @frupfrup, googling 'windows long path remover' brought me to that superuser link! Also thanks @Kernal Sterns for other ideas.

answered on Server Fault Jan 13, 2017 by pcort • edited Mar 20, 2017 by Community
1

Here is a .bat file to delete . from the current directory:

@echo off
for %%* in (.) do set CurrDirName=%%~nx*
cd ..
rmdir /s %CurrDirName%

For anyone who is actually taking this seriously, please be aware this command is rather destructive.

answered on Server Fault Jan 14, 2017 by Stephen Rauch • edited Apr 13, 2017 by Community
0

i had an similar problem some months before. I also tried everything with Powershell / CMD and other Windows standard featueres. Nothing helped.

At least a colleague tried it with a third party tool named "Long path remover" (from "Thorsten Eggeling"). This tool could also remove folders with not compliant names. But i don't find it on the internet anymore... Maybe you can or you try it with an similar tool that may help you. Maybe an other remover tool could delete it too.

EDIT: but it is very sad, that there is no Windows integrated way to delete this folder... or at least no easy way... maybe someone else has an good idea.

answered on Server Fault Jan 13, 2017 by frupfrup

User contributions licensed under CC BY-SA 3.0