Linux rm command

Dear Experts,

Somehow, I found on my root directory in which it
has direcotry named ec2-user\r/ that I want
to delete it. But it can not do that by

rm -rf ec2-user\r

or
rm -rf  "ec-user\r"

Probably the directory is created by my wrong script with "\r" putting to the directory
name.

How I can I delete it

Pleaea advise
Duncan
LVL 13
duncanb7Asked:
Who is Participating?
 
duncanb7Connect With a Mentor Author Commented:
Finally solved it by first rename it
rename $'\r' '' *
0
 
duncanb7Author Commented:
it is solved suddenly on my command with rename $'\r' "" *

http://unix.stackexchange.com/questions/60779/how-do-i-remove-carriage-returns-from-directory-names
Duncan
0
 
woolmilkporcCommented:
Just using single quotes would have been sufficient:

rm -rf  'ec-user\r'

The link you found deals with renaming, not removing (yet it helps).

Renaming can be done with single quotes as well:

mv 'ec-user\r' ec-user

wmp
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
duncanb7Author Commented:
if it can be renamed as normal direcotry name , it is of course that  can be deleted
0
 
woolmilkporcCommented:
Sure.

But why the extra effort of renaming before deleting when a single step is sufficient, just by using single quotes?
0
 
duncanb7Author Commented:
The thread is already closed
0
 
woolmilkporcCommented:
I just wanted to help. Sorry for bothering you.
0
 
duncanb7Author Commented:
Just want to reminder you the thread is closed so just worry you
did not see it. Anyway Thanks for your help
0
All Courses

From novice to tech pro — start learning today.