Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Linux rm command

Posted on 2013-11-10
8
423 Views
Last Modified: 2013-11-10
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
0
Comment
Question by:duncanb7
  • 5
  • 3
8 Comments
 
LVL 13

Accepted Solution

by:
duncanb7 earned 0 total points
ID: 39636825
Finally solved it by first rename it
rename $'\r' '' *
0
 
LVL 13

Author Closing Comment

by:duncanb7
ID: 39636828
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
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39636860
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 13

Author Comment

by:duncanb7
ID: 39636873
if it can be renamed as normal direcotry name , it is of course that  can be deleted
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39636889
Sure.

But why the extra effort of renaming before deleting when a single step is sufficient, just by using single quotes?
0
 
LVL 13

Author Comment

by:duncanb7
ID: 39636895
The thread is already closed
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39636900
I just wanted to help. Sorry for bothering you.
0
 
LVL 13

Author Comment

by:duncanb7
ID: 39636917
Just want to reminder you the thread is closed so just worry you
did not see it. Anyway Thanks for your help
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question