Service Functions - System (WinRunner, TSL)

Categories: File System OperationsFunction library

In the code examples I present I often refer to routine functions.

In my framework I have specialized libraries to call from. In my blog I maintain the similar structure.

Create Folder

public function sys_mk_dir(in dirpath, in dirname) {
 auto rc, cmd_line;
 cmd_line = dirpath & "\\" & dirname; 
 rc = dos_system("MkDir " & "\"" & cmd_line & "\"");
 return(rc);
}

Copy File

public function sys_copy_file(in src, in dest) {
 auto rc, cmd_line;
 if ((src == "") || (dest == ""))
 return(E_GENERAL_ERROR);
 cmd_line = "\"" & src & "\"" & " " & "\"" & dest & "\"" & " /Y"; 
 rc = dos_system("copy " & cmd_line);
 return(rc);
}
<h4>Copy File</h4>
1
public function sys_copy_file(in src, in dest) {
 auto rc, cmd_line;
 if ((src == "") || (dest == ""))
 return(E_GENERAL_ERROR);
 cmd_line = "\"" & src & "\"" & " " & "\"" & dest & "\"" & " /Y"; 
 rc = dos_system("copy " & cmd_line);
 return(rc);
}

Delete File

public function sys_del_file(in fname) {
 auto rc, cmd_line;
 if (fname == "")
 return(E_GENERAL_ERROR);
 cmd_line = "\"" & fname & "\"" & " /F"; 
 rc = dos_system("del " & cmd_line);
 return(rc);
}

How to generate filename with a timestamp

How to generate filename with a timestamp


  • Leave a Reply

    * Required
    ** Your Email is never shared

Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by the author is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.