Windows delete folder name too long
Ashish, while I laud your desire to increase the collective knowledge of StackOverflow, this is due to its non-programming nature probably more suited to SuperUser. So I and a few others by the looks of it are nudging it over to there. Add a comment. Active Oldest Votes. It's Empty??? Now run the command of remove directory which we created for mapping rmdir deleteLongFilesDir from command line.
This worked! This ran for about 10 minutes and showed no sign of stopping, so I Cntrl-C then re-ran the robocopy command and it completed in less than a minute. After the rmdir command, all was well - empty classes directory! After completion, my D: drive had 46 MB additional free space. I've never been that happy to see my files disappearing.
This worked like a charm. Great help. Thanks for your feedback. That removes them completely and they do not go into the recycle bin. Running Win7 X I recently installed Seagate Dashboard backup software.
After some slow loading problems, it is now working properly. Somehow, I created 3 different full back up files on my external drive. I tried to delete two of these around GBs each without success.
Windows says the file names are too long for the Recycle Bin to handle. Is there anyway to delete these preferably the folder that holds them by bypassing the recycle bin? Thanks for your help. The Windows API has a special function that supports Unicode path names up to 32k characters long each element being up to characters in length.
Note that some, poorly written but sadly quite common, applications do not support UNC file paths nor the long path prefix. This is an option that has been added to recent versions of Windows It is not, at the time of writing, activated by default since it requires specific application support. Interestingly, PowerShell has support built in so enabling this option will allow long paths to be used directly in PowerShell scripts.
You can activate it via the Group Policy editor if you have a version of Windows with that. Or you can simply use the following Registry change.
As always, please back up the section of the registry you are changing before doing anything. Any applications with appropriate manifest entries will now have access to POSIX standard long paths.
This should include Windows Store apps. It looks like you can now set long filename support with a system key:. This still only works for applications that are specifically set to use it though requires an entry in the application's manifest.
The 7-zip solution works great. Another option if you have git installed is to open a bash shell and use:. I like the cmd solution. Although I want to share another workaround that even works in just Explorer: try to shorten the names of the parent folders before deletion: shorter names will shorten the path. Say, you have this tree structure of the folder:. In this case you cannot delete the folders, you cannot delete or rename the files neither. If you want to remove the whole folder structure or part of it, you can temporarily rename the parent folders and shorten the path, and then remove the folder.
The names can be just letters:. In my case I just wanted to remove the whole folder with many subfolders and files. So I didn't care about folders' names. I suggest Total Commander shareware, but keeps working after trial period with only a minimal nag start screen.
That is the way I allways solve the too long filename issues. You can also delete them using their equivalent short name. I created a simple java program that uses robocopy to delete the files.
The jar is a runnable one. For additional output run it from cmd line. I came across delinfile and worked quite well and pretty quickly! Bigger Directories is designed for this task as well. More info at CodeProject. Not a single alternative answer in 4 questions was sufficient for my needs. You're welcome world. I finally found out how to do this via Powershell. Here are the instructions I followed for getting this to work on Windows I finally found out how to do this with Powershell on Windows 10 where the individual filenames were too long.
Here are the steps I followed for getting this to work on Windows If you have Bash on Ubuntu on Windows installed, you can cd to the parent directory in a regular command prompt and then type:.
Which launches bash, recursively deletes the directory from linux where there are no filename restrictions, and then exits back to your regular command prompt. Then you can delete the file as usual. If you have NodeJS npx package, you can just run this command without having to install the package globally. Sign up to join this community. The best answers are voted up and rise to the top.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Asked 12 years, 1 month ago. Active 8 months ago.
Viewed k times. If I try deleting the directory from Explorer I get the error Cannot delete [file name]: The file name you specified is not valid or too long. Specify a different file name Trying Remove-Item in powershell gives the following error: Remove-Item : The specified path, file name, or both are too long. The fully qualified file name must be less than characters, and the directory name must be less than characters. Improve this question. Herms Herms 8, 9 9 gold badges 33 33 silver badges 36 36 bronze badges.
I found the solution just before posting this question, but since others may run into this I decided to post it so that they could find the solution I ran across. Oh I know, but generally when I do things like this I leave the question "unanswered" for a while to see if anyone else has a better solution.
By Far the simplest solution: youtube. This older question has some interesting answers too: superuser. Actually, is there anybody who knows why Windows made such a restriction after all?
It seems to make little sense since a lot of third-party tools can just circumvent this restriction with ease, so it certainly doesn't seem to be something inherent with the filesystem or whatnot. Seems to only add difficulty for the user, what for? Show 5 more comments. Active Oldest Votes. Use the 7-Zip File Manager to delete them. Improve this answer. Run5k Dentrasi Dentrasi If you select the Delete option from the context menu, it WILl fail there.
I upvote this because with 7zip you can delete also delete a folder wich contains long nested folders inside. Show 22 more comments. Then you can run: npm install -g rimraf Then you can run rimraf from the command line.
Tried many ways. This just works perfectly! The best answer of all : yes its easy beasy — Al-Mothafar. This should be the accepted answer. Your solution works but this is so f k-up that I have to use a node js module for deleting node js modules folders I do not want to live on this planet anymore — Benoit P. Node created the problem in the first place for me so Show 13 more comments.
There is no need to install any program for solving this issue. After executing robocopy , the target directory would be empty as well. You don't need it anymore.
Thank-you good sir!!
0コメント