Super User is a question and answer site for computer enthusiasts and power users. 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 accidently created a folder which has the same name of a folder which was already existing in the same parent directory. i want to delete the newly created directory. is ther a way to identify the new directory based on a unique id or is ther a way delete all the folders whcih was created after a particular timestamp? The original directory should be untouched. Any workaround for this?

Thanks Prasun

share|improve this question

migrated from Feb 6 '13 at 15:05

This question came from our site for professional and enthusiast programmers.

Do you have a directory containing two subdirectories of the same name? That should not be possible. – Joachim Pileborg Feb 6 '13 at 12:09
Hi all, Thanks for ur time. The main issue was while creating the new directory an extra ** character was appended to the folder name (dunno how) and while doin an ls these characters were not displaying. Hence it lokked like i've folders with the same name. I chceked the same folder using filezilla and found out that the folder name was different. Copied the folder name and pasted back into unix while deleteing the folder and it was successful. joachim Pileborg: yes u are right, even i was puzzled and find command will be useful some day thanks :). David Water: Thanks for the info :) Prasun – user1196851 Feb 6 '13 at 12:55

To find files created after a specific date, you could use the find command:

$ find . -type d -ctime -1

The above command will find all directories (-type d) changed since yesterday (-ctime -1).

share|improve this answer

When a file or a folder has seemingly identical names then you can pipe the ls output though od. See man(1) od or this webpage. That will decode the output to octal, thus showing chars which are not visible as ASCII.

Alternatively you can refer to the folders inode. Use the -i option for this.
(e.g ls -i -d testdir*, assuming both your folders seem to be called testdir).

A third solution is in Joachime's answer. Sort folder names on time and access the desired folder that way.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .