Friday, 24 August 2012

To Copy a set of files from a given folder in file structure to another folder on file structure


for $Each in  xdmp:filesystem-directory($InputFileDirectoryPath)/dir:entry
 let $EachInputFilePath := $Each/dir:pathname
 let $EachInputFilename := $Each/dir:filename
 let $EachInputFileContent := if (xdmp:filesystem-file-exists($EachInputFilePath) ) then xdmp:filesystem-file($EachInputFilePath) else ( )
 let $EachOutputFilePath := fn:concat($OutputFileDirectoryPath, $EachInputFilename)
 let $EachOutputFileContent := xdmp:unquote($EachInputFileContent)
 return
  xdmp:save($EachOutputFilePath , $EachOutputFileContent)

No comments:

Post a Comment