# HOWTO: delete two worded files



## max21 (Oct 27, 2018)

https://forums.freebsd.org/threads/cant-delete-file-with-strange-name.14612/

This thread is older then Methuselah and the only one about find & delete strange files.  I don’t know what the OP did wrong but Alt had it right from the jump.  There are a few types of solution at the end of this thread but they might be a bit more complicate.  I have been trying to do this like forever like some of you.  I tried this on *Visited Links* in a  Opera directory.


```
find /win/d/opera/profile/data/ -name Visited\* -delete
```
.
.
So if you got two worded files on another partition that is accessible by a FreeBSD Host running Virtualbox, this problem is SOLVE!

Thanks Alt

You saved me from wasting a lot more time.
.


----------



## skhal (Oct 31, 2018)

It will remove everything that starts with Visited. Instead, put the whole thing into quotes or escape the space, to stay on the safe side and remove only ‘Visited Links’.


----------



## ekingston (Oct 31, 2018)

Any of the following will remove a file named "Visited Links".


```
rm "Visited Links"
rm Visited\ Links
rm 'Visited Links'
```

It will not remove directories.

The double quotes (") will interpret shell variables, back-quotes and backslashes are interpreted.
The backslash (\) will escape the next character (treat it as a regular character). You can also use this to escape wildcard characters and quote marks within a filename.
The single quotes (') will not interpret anything within the string.

[Edited to correct explanation, thanks olli@]


----------



## olli@ (Oct 31, 2018)

ekingston said:


> The double quotes (") will interpret wildcards and shell variables within the name.
> The backslash (\) will escape the next character (treat it as a regular character). You can also use this to escape wildcard characters and quote marks within a filename.
> The single quotes (') will not interpret wildcards within the name.


That's not completely correct.

Within double quotes, wildcards (“globbing”) are _not_ interpreted. However, the dollar sign, backquotes¹ (“backticks”) and backslashes are interpreted. Everything else is taken literally.
Within single quotes, _everything_ is taken literally (except for the closing single quote, of course).
The backslash escapes the next character, except within single quotes.
The above applies to the bourne shell and POSIX shells, i.e. our /bin/sh as well as zsh, ksh and bash.

¹ Note that backquotes are discouraged for several reasons. For command substitution, the $(…) syntax should be used.


----------



## usdmatt (Oct 31, 2018)

If I just need to delete a single file/folder with a weird name, I usually just start typing the name and use tab completion to let the shell sort out escaping the rest of the filename for me.


----------



## skhal (Nov 1, 2018)

olli@ said:


> That's not completely correct.
> 
> Within double quotes, wildcards (“globbing”) are _not_ interpreted. However, the dollar sign, backquotes¹ (“backticks”) and backslashes are interpreted. Everything else is taken literally.
> Within single quotes, _everything_ is taken literally (except for the closing single quote, of course).
> ...



agree: file blobbing is not done within any quotes, that's the point of say:


```
find /some/folder -type f -name "*.jpg"
```

which is going to find for regular files in /some/folder recursively, whose suffix is jpg. The star is not expanded here.


----------

