Aug 20, 2012

PeopleSoft : Handling files in PeopleCode


/*********** To move file data***************/
Exec("cmd /c move " | &file1 | " " | &file2, %Exec_Asynchronous %FilePath_Absolute);

/*********** To copy file data***************/
Exec("cmd /c copy " | &file1 | " " | &file2, %Exec_Asynchronous %FilePath_Absolute);

/*********** To delete the file**************/
Exec("cmd /c del " | &file1, %Exec_Asynchronous %FilePath_Absolute);

***********************************************************OR**********************************************************  
/*********** Create java objects corresponds to files ****************************/                           
Local JavaObject &f = CreateJavaObject("java.io.File", "/the/path/to/the/file.txt"); 
Local JavaObject &target = CreateJavaObject("java.io.File", "/the/target/file.txt"); 

&f.renameTo(&target); 

Local JavaObject &f = CreateJavaObject("java.io.File", "/the/path/to/the/file"); 

&f.delete(); /* delete the file from source */

No comments:

Post a Comment