0

I have file abc.txt and i need to check that file exists in suppose c:\test\abc.txt location

If true then I need to print some message else I need to perform some operation.

AlBlue
  • 23,254
  • 14
  • 71
  • 91
user2022204
  • 35
  • 1
  • 6

1 Answers1

1

Best is to use ant <available ../> to fill a property and then either using ant-contrib <if> task or create separate targets that run depending on the property value.

Check this answer for details: Ant task to run an Ant target only if a file exists?

Community
  • 1
  • 1
MrsTang
  • 3,119
  • 1
  • 19
  • 24
  • Tang thanks, but i need to check a file in particular directory how can i check file from one directory to another – user2022204 Jan 30 '13 at 16:07
  • see https://ant.apache.org/manual/Tasks/available.html and its examples - `file` can hold a path, so you could use `c:\test\abc.txt`. – MrsTang Jan 30 '13 at 16:13