I am trying to make a system which involves "file management" so the only thing that bothers me is how to rename file duplicates like for example:
I also understand the other thread answers related to my question here But I am using Mysql Database with Java and I honestly cannot think of a way to adapt it in my case.
Anyone with an idea about it, please share. Thanks a lot!
If you are storing fileName in database, then you can follow these steps
If you are getting a file name file.txt then make a call to db with
select count(*) from table where fileNmae="file.txt"
If this count is greater than 0 then insert file into table with name file(1).txt (for renaming follow link)