Solved

Linux rm command

Posted on 2013-11-10
8
413 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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 …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now