nir sharma wrote:
abrar alvi wrote:
you can use fileaddress.getParent(); to get the parent directory and your variable filename already contain the file name or you can also use fileaddress.getName(); it wont make any difference though.
then you can store those in hashmap.
This should solve the issue but if not then can I know what is the issue you are facing?
Thank you Nir,
i have included HashMap to store the file name and its path....
problem now: filename is only returning the directory name but i need the file name inside it to be returned
this is my modified code:
this is the output:
{New Folder=C:\Documents and Settings\Abrar Alvi\Desktop\New Folder}
{New Folder (2)=C:\Documents and Settings\Abrar Alvi\Desktop\New Folder, New Folder=C:\Documents and Settings\Abrar Alvi\Desktop\New Folder}
{New Folder (3)=C:\Documents and Settings\Abrar Alvi\Desktop\New Folder, New Folder (2)=C:\Documents and Settings\Abrar Alvi\Desktop\New Folder, New Folder=C:\Documents and Settings\Abrar Alvi\Desktop\New Folder}
{New Folder (4)=C:\Documents and Settings\Abrar Alvi\Desktop\New Folder, New Folder (3)=C:\Documents and Settings\Abrar Alvi\Desktop\New Folder, New Folder (2)=C:\Documents and Settings\Abrar Alvi\Desktop\New Folder, New Folder=C:\Documents and Settings\Abrar Alvi\Desktop\New Folder}