100 GB of 2KB size files to delete, explorer bogs down, cmd tools not working
We are using an anti spam product that has created 100GB of 2KB average size files. It's kind of like a log file excpet each entry is a seperate file. I am trying to delete them all. Have used del *.* while in directory that reports back several file names too long. Have used rd /s for the directory contacting the files. That also complains of the long file names and then seems to stall. The best I have managed so far is using explorer to select a thousand at a time (or so) and then perm. delete them. This process is too tedious for this number of files and the understandable glacial times required to try and refresh browse lists while performing this process.Suggestions please! Thanks in advance for any help.
April 16th, 2010 2:57am

Go to the CMD prompt. You have to delete it using the 8.3 prompt. So, look for the file name(s), then do:ie: ThisFileNameIsTooLongBlahBlahBlah.boodel thisfil~1.booSame idea if it is a directory, use the 8.3 DOS name to remove it. That SHOULD work.Thanks,James
Free Windows Admin Tool Kit Click here and download it now
April 16th, 2010 6:43pm

Can you just delete the directory and recreate it?v/r LikeToCode....Mark the best replies as answers.
April 16th, 2010 7:16pm

Try using forfiles to process each file individually, that way failures will not stop the whole process. Something like this....untested but closeForfiles /P C:\Path /M *.* /S /C "cmd /c del /F /Q @file"
Free Windows Admin Tool Kit Click here and download it now
April 16th, 2010 7:32pm

Thanks for all the suggestions: Brinkman: How can I determine the 8.3 file name. There are thousands of files and the names are 50-60 characters or more. LiketoCode: As I mentioned in my post I tried rd /s. I already reanamed the directory and created a new one for capturing the log files. Gunner999: So this suggestion is to create a .bat file? I will check out the commands you have listed there and switches and see if I can get my head around your suggestion.
April 19th, 2010 5:51pm

Here is an example of one such file name: 18004memory@the_flako_danites@mydomain.com_Enjoy the feeling every and the doing from time to time,without stress for the body and mind, and a look at how well you achieve may be the easiest way to check yo_4732199E.eml How do I determine the 8.3 name of this file?
Free Windows Admin Tool Kit Click here and download it now
April 19th, 2010 6:02pm

Sailonmike, I created 571 files using your naming above, each file was about 1KB in size. The script below deleted them with no problem. Just change the value of “strPath” to the proper path. The script will ignore errors and will count all successful file deletes. Be sure to run this script with admin rights so you will not run into permissions issues. See if this will work for you. The shotname for this file is 18004M~1.EML. 'Enter the folder path Const strPath = "Your Folder Path" Dim objFSO, objFile, intCount On Error Resume Next Set objFSO = CreateObject("scripting.filesystemobject") Set objFolder = objFSO.GetFolder(strPath) For Each objFile In objFolder.Files objFSO.DeleteFile(objFile.Path) If Err.Number = 0 Then intCount = intCount + 1 End If Next MsgBox "Successfully deleted " & intCount & " files." Set objFSO = Nothing v/r LikeToCode....Mark the best replies as answers.
April 19th, 2010 9:55pm

LikeToCode, I'm going to call that an answer since you ran it on test files. I have not had a chance to run this yet due to other higher priority issues but I will run it when I get a chance. Thanks!
Free Windows Admin Tool Kit Click here and download it now
April 20th, 2010 9:34pm

Like to Code, I appreciate the help. You have provided more help than even the vendor of this application. Is this a VB script? How do I run it on the server? I know .bat files from way back but have never run a VB script. The path is D:\program files\globalactions_old All the nusiance files are in that folder.
April 26th, 2010 8:58pm

Hi SailOnMike, Thanks! Yes this is VBScript, first copy the code into notepad and change the value of "Const strPath" to Const strPath = "D:\program files\globalactions_old". Then choose a name and save the text file as that name with an extension of '.vbs' (ex. LongNameFileDelete.vbs). Now you can run this in a few ways the most common is to 'Double-Click' on the vbs or you can open a command prompt and drag the vbs file into the command window (setting the path to the file) and then click enter. The second is better if you have a 2008 server and UAC enabled, just be sure to open the command prompt with Admin Rights. In fact, be sure you are running this script with enough rights over the files you want to delete, to avoid NTFS permission issues. below is the script updated with your path. 'LongNameFileDelete.vbs Const strPath = "D:\program files\globalactions_old" Dim objFSO, objFile, intCount On Error Resume Next Set objFSO = CreateObject("scripting.filesystemobject") Set objFolder = objFSO.GetFolder(strPath) For Each objFile In objFolder.Files objFSO.DeleteFile(objFile.Path) If Err.Number = 0 Then intCount = intCount + 1 End If Next MsgBox "Successfully deleted " & intCount & " files." Set objFSO = Nothing v/r LikeToCode....Mark the best replies as answers.
Free Windows Admin Tool Kit Click here and download it now
April 27th, 2010 12:40am

Thanks again for the help. I created a test directory with some files in it (although no long file names). I changed the strPath and ran the script using the cscript method. It ran and deleted the test files. Next I revised the strPath to a second test directory. This directory contains about 150 files with very long file names and I put 3 test files with short file names. I ran the script and it skips over the long name files and sucessfully deleted the files with short file names. So far so good. Lastly I revised the strPath to my problem directory. I ran it again from the cscript. This time it seems to hang. I let it run for 10 min with no noticable results. I finally Ctrl C out of it. I browsed to the virtual drive. There was no free space created. As far as I can tell it deleted no files. As I stated in the original problem there are 100GB of average 2KB size files in this directory (10 million files?). I don't beleive all have very long file names but it's difficult to tell because explorer bogs down creating browse lists. I usually have to force explorer to close. Suggestions?
April 27th, 2010 7:47pm

Replace the portion of the script that looks like this WITH this. For Each objFile In objFolder.Files objFSO.DeleteFile(objFile.ShortPath) If Err.Number = 0 Then intCount = intCount + 1 End If Next And if that does not work try this script instead. Const strPath = "D:\program files\globalactions_old" Dim objFSO Set objFSO = CreateObject("scripting.filesystemobject") objFSO.DeleteFolder strPath, True MsgBox "Deleted."v/r LikeToCode....Mark the best replies as answers.
Free Windows Admin Tool Kit Click here and download it now
April 27th, 2010 8:33pm

#1 again appears to stall. Ctrl C to end after 30 min. No increase in available space on D: drive #2 Does delete a test folder with normal length file names but when run on the real folder, it produces the following message: deletefolder.vbs(8,1) ... VBScript runtime error: Path not found. Here is the exact text from the script. I have double checked for typos on my part and the folder path/names. Const strPath = "D:\program files\globalactions_old" Dim objFSO Set objFSO = CreateObject("scripting.filesystemobject") objFSO.DeleteFolder strPath, True MsgBox "Deleted."
April 27th, 2010 10:05pm

Hi Sailonmike!! What a debachle. Try this code. It attempts to delete the folder by it Short Path. I don't have a method of testing this one so i can't say if you will get the Path not found error again. Const strPath = "D:\program files\globalactions_old" Dim objFSO, objFolder Set objFSO = CreateObject("scripting.filesystemobject") Set objFolder = objFSO.GetFolder(strPath) objFSO.DeleteFolder objFolder.ShortPath, True MsgBox "Deleted."v/r LikeToCode....Mark the best replies as answers.
Free Windows Admin Tool Kit Click here and download it now
April 27th, 2010 10:28pm

Debacle is a good word for it. Not you fault though. The mess was created by a vedor a bug in their code who now won't support cleaning up the mess. Const strPath = "D:\program files\globalactions_old" Dim objFSO, objFolder Set objFSO = CreateObject("scripting.filesystemobject") Set objFolder = objFSO.GetFolder(strPath) objFSO.DeleteFolder objFolder.ShortPath, True MsgBox "Deleted." Produces: (6,1) VBScript runtime error:Path not found
April 27th, 2010 11:55pm

Well there is one last thing you can try, I forgot about this program until I just used it. This program is called Unlocker 1.8.9 it is a fabulous program from an admin point of view when it comes to locked files because it will tell you what has it locked and can unlock it for you. It also deletes files and folders. It is free and at least worth a try. http://download.cnet.com/Unlocker/3000-2248_4-10493998.htmlv/r LikeToCode....Mark the best replies as answers.
Free Windows Admin Tool Kit Click here and download it now
April 28th, 2010 1:39am

To all that helped: This problem has been solved. The solution that worked: All files were backed up, exchange was taken down, the partion was deleted, new partition created/formated with exact same name and file structure. Backup files moved back and server re-booted. Came up 100% operational. No further issues. I was told by an MSCE that apparently the OS (server 2008) will write files with up to 160 + char file names but once written you can not rename them or delete them. Nice.
May 12th, 2010 10:13pm

Your MCSE should check his facts. NTFS (all versions of Windows 200X) support filenames (filenames = c:\path\filename) upto 256 charcters or 259 with the C:\ characters counted. Belwo is simple batch file to create really long file path and filenames (259 characters) MD C:\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890 dir c:\>C:\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890\1234567890.txt However, 2008 and 2003 as well as utilities individual utilities (Windows Explorer vs Copy, xcopy, cmd, etc), may report different issues. One common problem is a path being around 250 charcters and then a FOLDER is renamed to push files in the lower folders past 260 charcters. In Windows 2003 these become stricktly inaccessible, in 2008 Windows Explorer seems to allow access. On the command line you should use the \\?\c:\ syntaxt to reference files in really long paths. exmaple: notepad \\?\c:\boot.ini
Free Windows Admin Tool Kit Click here and download it now
May 13th, 2010 12:55am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics