How can I delete a set of files that contain illegal characters including new lines? The file system is FAT32.

On Windows, besides trying with Explorer, which gave me a 80004005 error, I've tried rmdir, del /F and del "\\?\drive\...", from Administrator CMD of course.

On a friend's Ubuntu, I've tried rm -rf, which has given no results, besides errors of course.

The errors I've been getting from both systems revolve around the illegality of the syntax and no having no permissions. The 80004005 erros come from attempting to delete the parent folder. I've tried to chmod the files into complicity but it had no effect.

Curiously enough, attempting to view the files in Ubuntu's Explorer has also resulted in an error:
LS of the folder and an error from Ubuntu's Explorer

Additionally some of the files seem to contain new lines within their names. Very strange indeed. I don't really understand how this was allowed in the first place.

Is there anything else I could try besides a reformat?

Context: I'm getting into the whole password manager thing, and as part of that, I wanted to have a portable copy of my password manager on my USB stick. As such I've downloaded the portable version, and using WinRAR, I've attempted to unzip it into the USB. Errors occurred, iirc of similar nature, and now we're here.
The broken files only exist within the XSL which as a whole is broken. I'm not sure what WinRAR has done wrong, since initally it was only supposed to be 5 xsl files.
The password manager was KeyPass 2.

  • 1
    So, it’s a new USB drive that was hosed from the get go. Is there any reason you aren’t simply reformatting it and starting over? – Appleoddity Jan 27 '18 at 3:46
  • @Appleoddity Learning experience in case this happens on a system or backup partition. – Mox Jan 27 '18 at 4:11

Whatever corrupted your directory entries probably also corrupted the disc locations, some pointing to outside the partition, with consequent I/O errors.

You need to do a file system repair: try Windows first, but then Ubuntu if it fails.

If all else fails, copy all the other directories, format the disc, then copy back the valid directories; on a system disc you may need to do a clean re-install before copying the files back.

  • I've tried chkdsk /F with no use. It supposedly couldn't schedule the disk for a repair. Would you know to happen the Ubuntu disk repair tool? – Mox Jan 26 '18 at 22:49
  • My friend tried using mcheck on it, with no results. – Mox Jan 26 '18 at 22:52
  • The usb partition is FAT32 though, as mentioned in the question and tags. @AFH – Mox Jan 27 '18 at 20:24
  • @Mox - You're quite right: I came back to this after a break and didn't fully reread the question, thinking I'd remembered enough. I'll delete my irrelevant comment. Thanks. – AFH Jan 27 '18 at 23:21
  • I now don't know what to suggest: testdisk on Ubuntu can do some FAT repairs, but I don't know if these will help. – AFH Jan 27 '18 at 23:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.