Link to home
Start Free TrialLog in
Avatar of satmisha
satmishaFlag for India

asked on

convert Absolute path to relative path of FTP location

Hi Team,

I am using below FTP path in my code. I want to use relative path instead rather absolute path. Is it possible to convert this path into relative path ?

String FTPLocation = "44.24.10.11/upload/AutomationUploadFolder/Test-2.csv";
AIP.enterFileLocation(FTPLocation);

Open in new window


Looking forward to hearing from you.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

What is your motivation?
Hi Satmisha,

Conversion of an absolute path to relative path will require the base path first.

You can achieve that using relativize API of Path class. Check here https://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html#relativize(java.nio.file.Path)

You can get path from the file object too using toPath() method.

Best Regards,
Saurav
Avatar of satmisha

ASKER

Thanks experts for your prompt reply.

But I am sorry I am still unable to get ? first of all I myself confuse here, Is it possible what I am looking for ?

//44.24.10.11 --> is the ip of the FTP location
String FTPLocation = "44.24.10.11/upload/AutomationUploadFolder/Test-2.csv";
AIP.enterFileLocation(FTPLocation);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Saurav Sarkar
Saurav Sarkar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
a. what are you starting with?
b. what end result do you want?

You've told us a. but for some reason, not b.
Thanks Saurav for the greate explanation, appreciate your time. I got the point though. Thank you.
Glad to provide you with help Satmisha.

Best Regards,
Saurav