2

I am new to Latex, using TexStudio on Windows 10. I did something unexpected after typing the command to include a file and I had not closed the expression yet, I clicked "Yes" when TexStudio asked if it should create the non existing file. I was really distracted at that moment...

As result, TexStudio has created a series of nested folders with long names composed of pieces of my .tex file code. The very last folder in the queue is named " C$ ".

At any level I cannot delete any of these folders. Windows 10 says "It is no longer in that location", or runs the deletion but all the folders are still in place in the end. I also tried renaming folder through command line. I could rename some but not delete them, I could not rename " C$ " at all. How can I get rid of such folders?

Edit: When in some of the subfolders, I cannot do cd.. it says system cannot find path. Folder does not appear in net share attrib D:\[folder]\C$ and attrib \\?\D:\[folder]\C$ do not find the folder

TTT
  • 193
  • 1
  • 4
  • 12
  • 1
    `C$` is the name of one of the default windows admin share, the `$` sign means it is hidden. Do all this troubleshooting as admin. Type `net share`, see if its on this list. Type `attrib c:\folder\C$` see what it says. If that doesn't work `attrib \\?\C:\Folder\C$`. And may as well try both of these. Use RD to remove the top folder of this tree of folders `rd /s C:\Folder` and `rd /s \\?\C:\Folder`. `\\?\ ` turns of filename checks. – Mark Feb 06 '20 at 01:35
  • Thank you. After trying everything else, 'rd /s \\?\...' finally worked. If you write it as answers, I can check it as solution. – TTT Feb 06 '20 at 10:12

1 Answers1

2

Windows NT (Win 10 is latest version) is an OS that runs other OSs. Currently Windows and Unix, but in the past also OS/2.

So you can do things in the underlying NT OS that are illegal on Windows. The main thing with Windows is that programs allocate 260 characters to store filenames. If you create a file longer than this Windows' programs won't be able to access it, as you saw with trying to delete it in Explorer.

If you don't care about making files other Windows' programs can't read (because you're a database server say) OR you want to access a file created under Unix naming conventions you tell Windows to turn off Windows' filename checks (and you allocate 33K characters of memory to store the filename or your program will crash).

\\?\ Prepended to a fully qualified filepath turns off Windows' filename checks.

Try on the top unwanted folder

rd /s "\\?\C:\Folder"

See rd /?. /s deletes a tree of folders AND files.

For further information on filenames see https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file

Also see CMD Prompt Cheat Sheet https://winsourcecode.blogspot.com/2019/12/command-prompt-cheat-sheet.html

Mark
  • 706
  • 4
  • 3