0

I am logging in Copy task like:

[...]
from ("some/source/") {
  include "*.*"
  into "some/destination"
        
  eachFile { file ->
    logger.info("Copied ${file.sourcePath} -> ${file.path}" )
  }
}

file.sourcePath will just give me the files name. How can I get the absolute path? I am not getting warm with Gradle documentation yet.

AndreasInfo
  • 1,062
  • 11
  • 26
  • Does this answer your question? [What's the difference between getPath(), getAbsolutePath(), and getCanonicalPath() in Java?](https://stackoverflow.com/questions/1099300/whats-the-difference-between-getpath-getabsolutepath-and-getcanonicalpath) – cfrick Nov 23 '21 at 15:29
  • Not really. If I try `file.getCanonicalPath()` I get Execution failed for task ':updatelighttestme'. > Could not find method getCanonicalPath() for arguments [] on file 'C:\my\path\backup_db.bat' of type org.gradle.api.internal.file.copy.DefaultFileCopyDetails_Decorated. – AndreasInfo Nov 24 '21 at 07:44
  • I am using Gradle 5.6.4 btw. – AndreasInfo Nov 24 '21 at 07:45

0 Answers0