Re: get rid of files and directories with spaces in them

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Somebody in the thread at some point said:

> How does one get rid of files and directories with spaces in them?  I
> tried rm and it doesn't want to remove the files or folders?

You shouldn't be trying to type file paths literally.  Use the built-in
autocomplete stuff in bash, not only will it deal with spaces in
filepaths automatically solving your immediate problem, but your
efficiency at the commandline will go up hugely at no cost.

Eg, say your evil file is

"file with spaces"

if it is the only file in the directory beginning with f, for example,

rm f<tab>

will autocomplete the command line to

rm file\ with\ spaces

ie, it will fill in the file path complete with escaped spaces.  Just
hit enter to execute it.  Total keypresses: 8, including having to type
y and <enter> to accept it.

If there are more files that match, you can hit <tab> again to see the
list of possible matches, and type further characters to disambiguate.

-Andy


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux