Skip to content

How to use File Attributes at 4.0+

Looking for an example project to get you started?
  • Support_Duane Offline
  • Support Specialist
  • Posts: 66
  • Joined: Thu Mar 05, 2009 3:49 pm

How to use File Attributes at 4.0+

Post by Support_Duane »

This project that will write out the file attributes of a named file to the joblog. Modify the value of the first variable to a file that exists on your system and it should work as is.

Code: Select all

<project name="FileList Attributes" mainModule="Main" version="2.0" logLevel="silent">

	<module name="Main">

		<setVariable label="Init thisFile" name="thisFile" value="\temp\DirList.txt" version="2.0" />


		<setVariable label="Init path" name="path" value="${FileInfo(thisFile):parentFile}" version="2.0" />


		<setVariable label="Init badPath" name="badPath" value="${FileInfo(thisFile):parentFile}/notHere" version="2.0" />


		<print label="Print File Info to JobLog" version="1.0">
			<![CDATA[*================================================================================*
thisFile     = ${ thisFile }
path         = ${ path }
badPath      = ${ badPath}
-------------------------------------------------------------
    ** Attribute List **
    "thisFile" exists:                        ${ FileInfo(thisFile):exists }
    "path" exists:                            ${ fileInfo( path ):exists }
    "badPath" exists:                         ${ fileInfo( badPath ):exists }
    "thisFile" name:                          ${ FileInfo( thisFile ):name }
    "thisFile" extension:                     ${ FileInfo( thisFile ):extension }
    "thisFile" last modified date:            ${ FileInfo( thisFile ):lastModifiedDate }
    "thisFile" size:                          ${ FileInfo( thisFile ):size }
     "thisFile" path:                         ${ FileInfo( thisFile ):path }
    "thisFile" nameWithoutExtension:          ${ FileInfo( thisFile ):nameWithoutExtension }
    parentFile:                               ${ FileInfo( thisFile ):parentFile }
*================================================================================*]]>
		</print>

	</module>

	<description>Print File List Attributs to Job Log</description>
</project>