October 21, 2013

Two files, same name, same directory


Really hoping someone can help.

For a Uni project I need to create a trash can for Linux, much like the Windows one. Files are not deleted, just put in a trash can for safety purposes in case they deleted by mistake.

Anyway, I know you cant have two files with the same name in the same directory. Which is causing me bother with the mv command I am using to put files in the trash can, as it just overwrites the file that is there.

Is there a way to do this, perhaps hidden text on the filename or something like that? I was messing about with adding the date to the name when it was moved, but I am not sure how to remove that date when the file is restored back to its original location.

Any help would be great.

Click Here!