Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to delete one of two folders which is having exactly same name but containing different files in it. How can i delete specific folder from these two in terminal ?

share|improve this question

closed as off-topic by dobey, Mateo, psusi, guntbert, Braiam Sep 18 '13 at 0:01

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This describes a problem that can't be reproduced that seemingly went away on its own or was only relevant to a very specific period of time. It's off-topic as it's unlikely to help future readers." – Mateo, guntbert, Braiam
If this question can be reworded to fit the rules in the help center, please edit the question.

What? You can't have two subdirectories in a directory with exactly the same name... – Richard Sep 17 '13 at 17:23
The two directories (folders) must have either a different name or different path (location). You would use the proper name or proper path with the rm command rm -rfi /path/to/directory , careful with the rm command, if you use the wrong location you will loose data. – bodhi.zazen Sep 17 '13 at 17:26
@searchfgold6789 I have this situation in a directory. It happens due to copying a directory(of same name) by scp command from remote. – Durgesh Suthar Sep 17 '13 at 17:29
Are you sure there is no whitespace at the end of one of the names and the case of all characters is the same? – soulsource Sep 17 '13 at 17:33
@DurgeshSuthar Can you post the output on Copy exactly as it is from terminal. – Radu Rădeanu Sep 17 '13 at 17:44
up vote 0 down vote accepted

I have solved this issue by a different way. Like someone have two folders of same name as sub in a directory dir
First I renamed one of directory ( I don't know which). Then checked the directory got renamed by seeing contents of it.

mv dir/sub dir/sub1

And then deleted the directory which is not required ( live sub1 is not required)

rm -r dir/sub1

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.