Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com Feb 6 '13 at 15:05

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

3  
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

2 Answers 2

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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