Example batch files on a Linux system

This topic presents sample batch files for a Linux system for your reference.

This following sample batch file copies all of the dpx files from /data/mymovie to /mnt/ltfs/proj1_dpx:
<?xml version="1.0" encoding="UTF-8"?>
<ltfscpspec version="1.0">
 <data>
  <file>
   <srcpath>/data/mymovie</srcpath>
   <dstpath>/mnt/ltfs/proj1_dpx</dstpath>
   <srcspec>*.dpx</srcspec>
  </file>
 </data>
</ltfscpspec>
The following sample batch file copies all of the dpx files and two doc files from /data/proj1 to /mnt/ltfs/project1. Warning level reporting is specified.
<?xml version="1.0" encoding="UTF-8"?>
<ltfscpspec version="1.0">
 <params>
  <loglevel>WARNING</loglevel>
 </params>
 <data>
  <file>
   <srcpath>/data/proj1</srcpath>
   <dstpath>/mnt/ltfs/project1</dstpath>
   <srcspec>*.dpx</srcspec>
  </file>
  <file>
   <srcpath>/data/proj1</srcpath>
   <dstpath>/mnt/ltfs/project1</dstpath>
   <sf>copyright.doc</sf>
   <sf>readme.doc</sf>
  </file>
 </data>
</ltfscpspec>
The following sample batch file copies three dpx files to /mnt/ltfs/project1_backup and then copies three other files to another directory on tape while renaming them. Information level reporting is specified.
<?xml version="1.0" encoding="UTF-8?>
<ltfscpspec version="1.0"
 <params>
  <loglevel>INFO</loglevel>
 </params>
 <data>
  <file>
   <srcpath>/data/proj1</srcpath>
   <dstpath>/mnt/ltfs/project1</dstpath>
   <sf>frame001.dpx</sf>
   <sf>frame002.dpx</sf>
   <sf>frame003.dpx</sf>
  </file>
  <file>
   <srcpath>/data/proj1</srcpath>
   <dstpath>/mnt/ltfs/project1_backup</dstpath>
	 <sf rename="frame011_copy.dpx>frame011.dpx</sf>
  	 <sf rename="frame012_copy.dpx>frame012.dpx</sf>
   <sf rename="frame013_copy.dpx>frame013.dpx</sf>
  </file>
 </data>
</ltfscpspec>

In the following sample batch file, three command line options are specified in the params section: debug level reporting, recursive file copying, and sparse file creation. The command line options are read first, followed by the tags in the batch file. For this reason, if contradictory options are set in the command line option and batch file, the options in the command line are overwritten by the those in the batch file.

In the data section of the following sample batch file, three file groups are specified. In this example, the same test folder is specified as the source path using the relative path. In the first file section, all files with the suffix .cc in the folder test are copied to the folder x. The folder x is created if it does not already exist. In the second file section, ltfscp finds Audit?.h, such as AuditX.h, Audit0.h, and so on. All of the found files are copied to the relative path y under the current folder. In the third file section, ltfscp locates Message.cc in the folder test, but finds that this operation duplicates the existing copy that was created using the wildcard in the first file section. In this case, the copy of Message.cc is deleted. Two files, Message.cc and Message.h, in the folder x are copied and renamed to Message_bak.cc and Message_bak.h.
<?xml version="1.0" encoding="UTF-8"?>
<ltfscpspec version="1.0>
 <params>
  <loglevel>DEBUG</loglevel>
  <recursive>enable</recursive>
  <sparse>enable</sparse>
 </params>
 <data>
  <file>
   <srcpath>test</srcpath>
   <dstpath>x</dstpath>
   <srcspec>*.cc</srcspec>
  </file>
  <file>
   <srcpath>test</srcpath>
   <dstpath>y</dstpath>
   <srcspec>Audit?.h</srcspec>
  </file>
  <file>
   <srcpath>test</srcpath>
   <dstpath>x</dstpath>
   <sf>Message.cc</sf>
   <sf rename="Message_bak.cc">Message.cc</sf>
   <sf rename="Message_bak.h">Message.h</sf>
  </file>
 </data>
</ltfscpspec>