exec (execute commands from file)

Top  Previous  Next

The exec command is used to load and execute a list of commands from a text file.
 

exec FILE_NAME [-tofile:OUTPUT_FILENAME]

 

Option

Description

FILE_NAME

A file name is required. This is the name of a text file, saved with standard ASCII or UTF-8 encoding, that contains a list of S3Express commands to be executed. Each command must be on a separate line. If there are comment lines in the file, they must start with character #.

 

If the file name contains spaces, then it must be surrounded by double quotes (").

[-tofile:OUTPUT_FILENAME]

Optionally log output to a file. See Redirect Output to a File

 

Examples
 
exec commands.txt (load and execute commands from file "commands.txt" in the current directory, usually the same directory where S3Express.exe is, unless it was changed)
 
exec "c:\folder\subfolder A\my commands.txt" (load and execute commands from file "c:\folder\subfolder A\my commands.txt")
 
exec "c:\folder\subfolder A\my commands.txt" -tofile:"c:\folder\subfolder A\output.txt"  (load and execute commands from file "c:\folder\subfolder A\my commands.txt". Redirect S3Express output to "c:\folder\subfolder A\output.txt")

 

A) Example of a Text File Containing Commands
 
# Comment <- this is a comment
ls
put c:\folder\  mybucket -onlydiff -keep
quit
# Another comment
 
B) Example of a Text File Containing Commands
 
# Set OnErrorSkip to ON. See OnErrorSkip for more details.
OnErrorSkip ON
 
# Put first folder. If error it will skip the other commands, because OnErrorSkip ON was set
put c:\folderA\ mybucket\folderA\ -s -onlydiff -purge
 
# Pause 10 seconds. See Pause command for more details.
pause 10
 
# Put second folder.
put c:\folderB\ mybucket\folderB\ -s -onlydiff -purge
 
# finished
quit
 
C) Example of a Text File Containing Commands
 
# Put first folder. If error, it will NOT skip the other commands, because OnErrorSkip ON was not set.
put c:\folderA\ mybucket\folderA\ -s -onlydiff -purge
 
# Pause 10 seconds. See Pause command for more details.
pause 10
 
# Put second folder.
put c:\folderB\ mybucket\folderB\ -s -onlydiff -purge
 
# Whatever happened, I do not want the exit code to report an error, use ResetErrorStatus
ResetErrorStatus
 
# finished
quit
 

 

Notes:
- If one of the commands in the text file fails (i.e. it returns an error), the other commands are still executed, unless you specify OnErrorSkip ON.
- S3Express.exe returns 0 if all executed commands were successful. It will return 1 otherwise. You can reset the error status with command ResetErrorStatus.