Solved

delete folder, subfolders, files in cmd command - get error name.txt too long

Posted on 2011-09-19
9
787 Views
Last Modified: 2012-05-12
i have a folder that was robocopy /mir and it created lots of sub folders and files

i am trying to delete it with cmd commands

del c:\clients\users /s /f /q

it looks like it is rolling along and then stops with:
clientname.txt is too long

how can i get this to delete?

thanks
0
Comment
Question by:webdott
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 9

Expert Comment

by:Lester_Clayton
ID: 36565148
Unfortunately the path and filename is too long to process, there are two things you can try to do:

Option 1: Share Deep.

find a directory that's quite deep down that you can still access, share the folder, then map a drive to the same share, and see if you can delete the remainder through DOS or Windows Explorer.  This is not guranteed to work unfortunately, but it's worth a shot.

Option 2: Rename Rename Rename

Rename folders above which will reduce the path length.  For example, if your folder structure is like this:

D:\This is a\stupidly long\folder name and\I should be\castrated\as a result\blahblah\gibber\file.txt

Then rename each folder so that the whole path is shorter:

D:\A\B\C\D\E\F\G\H\file.txt

You will then be able to rmdir the folder.
0
 
LVL 21

Expert Comment

by:Hendrik Wiese
ID: 36565156
Use the following to remove the Folder with all Sub Folders and Files:

The following will delete the entire users folder with everything in it.
rmdir /s /q "C:\clients\users"
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 36565574
Good point on the share to make path shorter.... another way is to use command.com

I don't know off hand if this is present still on 2008 but if not do it from a mapped drive on an XP workstation, or from a 2003 server.

Start cmd.exe (as administrator if on the 2008 box).
type command.com
Now paths are in short 8.3 name format.
c:
cd \clients\users
rd /q /s c:\clients\users

You can use
dir /x

to see the short names of the dirs to CD into to make the paths shorter.
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
LVL 8

Expert Comment

by:subhashchy
ID: 36566328
i think Command.com is not present in 2008.

how about just Selecting the root folder and SHift Del ? if the idea is just to del the folders, just a thought.
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 36566521
I think the problem here is that the files have been created end up breaking limits on the length of full path / filename.  Mapping a drive part what down the tree of the directory, or renaming like has been suggested effectively reduces the path, as does using 8.3 names for long ones.
0
 
LVL 54

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 36566569
0
 

Author Closing Comment

by:webdott
ID: 36576247
thanks - that is a nice tool!
0
 

Author Comment

by:webdott
ID: 36576249
0
 
LVL 54

Expert Comment

by:Bill Prew
ID: 36577386
Great, glad that proved to be useful.

~bp
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I was supporting a handful of Windows 2008 (non-R2) 2 node clusters with shared quorum disks. Some had SQL 2008 installed and some were just a vendor application that we supported. For the purposes of this article it doesn’t really matter which so w…
You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question