1
  1. I have source as local file and target as File share.
  2. I want to move all files from local file folder to file share folder.

Please help me to do this.

Roman Pokrovskij
  • 9,449
  • 21
  • 87
  • 142

1 Answers1

0

When you say local, are you referring to local to your private agent server? If so, you could do run FileList(), then ReadFile(). Then just write the files back to your target location as an FTP (or, just to a shared folder on the Jitterbit server). If I'm off on what you are trying to do, please let me know. Happy to help out.

<trans>
  $sourceFileNames=FileList("<TAG>Sources/Read_All_Test_Files</TAG>"); 
  $numberofFiles=Length($sourceFileNames); 
  While($numberofFiles>0, 
    $fname=$sourceFileNames[$numberofFiles-1]; 
    WriteFile("<TAG>Targets/Move_Test_Files</TAG>",ReadFile("<TAG>Sources/Move_Test_Files</TAG>",$fname),$fname);
    $numberofFiles--;
  ); 
</trans>
w3bguy
  • 2,215
  • 1
  • 19
  • 34
  • 1
    I have used following script – user10494007 Oct 15 '18 at 11:02
  • 1
    I have used following script $sourceFileNames=FileList("Sources/INV_ARC_MOVE_Source"); $numberofFiles=Length(FileList("Sources/INV_ARC_MOVE_Source")); While($numberofFiles>0, WriteFile("Targets/INV_ARC_MOVE_Target", ReadFile("Sources/INV_ARC_MOVE_Source",$sourceFileNames[$numberofFiles-1]), $fname=$sourceFileNames[$numberofFiles-1]);$numberofFiles-1); In source, file name is * (all files) In target, file name is $fname When I have run, its continue running, not getting anything output. – user10494007 Oct 15 '18 at 11:09
  • Here you go. I made a couple of minor alterations. This one works fine with my SFTP servers. One specific item I notices is that you used $numberofFiles-1;. That doesn't work. It should be $numberofFiles--;. Next comment holds the script. – w3bguy Oct 15 '18 at 12:50
  • $sourceFileNames=FileList("Sources/Read_All_Test_Files"); $numberofFiles=Length($sourceFileNames); While($numberofFiles>0, $fname=$sourceFileNames[$numberofFiles-1]; WriteFile("Targets/Move_Test_Files",ReadFile("Sources/Move_Test_Files",$fname),$fname); $numberofFiles--; ); – w3bguy Oct 15 '18 at 12:50
  • Sounds great. Can you mark this as the answer? I'll update my answer with the script. – w3bguy Oct 17 '18 at 11:13