0

I have a lot of folders in a directory and some are starting with the character '. I would like to remove these.

Example folders

  • Folder.A
  • 'Folder.B' <-- want to delete this
  • 'Folder.C' <-- want to delete this
  • Folder.D

I can get help building a string with typing echo 'My.Folder and by pressing tab the whole name prints echo 'My.Folder.With.Full.Path'. However. If I start typing echo '* and press enter I'm getting some kind of input prompt starting with >.

Running: Ubuntu 18.04.3 LTS 4.15.0-51-generic

roady
  • 101

1 Answers1

2

The ls -Q and ls -N results mentioned in the question comments indicate that the single quotes are not actually part of the folder names, but added by the program doing the listing, as there apparently is a character in the name that is considered somehow special.

See also this question for a more in-depth explanation of what is going on. In short, the coreutils developers decided to make ls start quoting filenames with special characters in them by default.

The > prompt is unrelated: it appears because you had unbalanced quotes when pressing Enter. The shell assumes you're not done with the command line yet and prompts you to write the rest of the quoted section. If you do this, the quoted section will now include an actual newline character within it.

telcoM
  • 96,466