Copy Files Section


CopyFiles

[CopyFiles-section-name]
destination-file1-name(,source-file1-name)(,temporary-file1-name)(,flag)
destination-file2-name(,source-file2-name)(,temporary-file2-name)(,flag)

A list of the names of files to be copied from a source disk to a destination directory. The source disk and destination directory associated with each file are specified in other sections of the INF file. The file-list-section name must appear in the CopyFiles item of an Install section.

Note that you can specify the copying of a single file in the CopyFiles item of the Install section itself, without building a CopyFiles section. To do this, use the special character "@" to force a single file copy. An example of using the "@" character in a CopyFiles-type item is in the Install section reference topic. Copying a single file in this way is somewhat limited because the source and destination filenames must be the same in this case and you cannot use a temporary file.

destination-file-name
Name of the destination file. If no source filename is given, this is also the name of the source file.

source-file-name
Name of the source file. If the source and destination filenames for the file copy operation are the same, this is not required.

temporary-file-name
Name of a temporary file for the file copy operation. The installer copies the source file but gives it the temporary file name. The next time the operating system starts, it renames the temporary file to the destination file name. This is useful for copying files to a destination which is currently open or in use by Windows.

If the file is not in use by Windows, use flag 8 to force it to use the temporary name. This will only work if the file already exists in in the target folder. To get around this, first copy the file into the folder, then use flag 8 to copy it again.

flag
Optional parameter used to perform special actions during the installation process. Multiple flags can be used by adding the values to create the combined flag. The following valid flags can be used:

Value Meaning
1 On CopyFiles: Warn if user tries to skip file.
1 On DelFiles: If file is in use, queue up delayed delete in wininit.ini. Otherwise an in-use file will not be deleted.
2 Setup Critical: don't allow user to skip file.
4 Ignore version check and always copy file. This will overwrite a newer file.
8 Force Rename (trick engine into thinking that file is in use). Note: Only happens if file already exists on target.
16 If file already exists on target, don't copy.
32 Suppress version conflict dialog and don't overwrite newer files.
64 Copy the source file to the destination directory only if the file on the destination will be superseded by a newer version.
128
256
512
1024 Copy the source file to the destination directory only if the file is already present in the destination directory.
2048 Copy the source file to the destination directory without decompressing the source file if it is compressed.
4096 This file is required by the system loader. The system will prompt the user to reboot the system
8192 Do not delete this operation as a result of optimization.

This example copies three files:

[CopyTheseFilesSec]
file11 ; copies file11
file22,,file23,8 ; copies file22, temporarily naming it file23
file31,file32 ; copies file32 to file31


All the source filenames used in this example must be defined in a SourceDisksFiles section and the logical disk numbers that appear in the SourceDisksFiles section must have been defined in a SourceDisksNames section. As an alternative, you can use a LAYOUT.INF file to supply this information.

You also must define the destination directory for each CopyFiles section using the DestinationDirs section. More than one destination directory requires more than one CopyFiles section.