Function Reference


_FO_GetCopyName

Returns the name of a nonexistent file copies.

#Include <FileOperations.au3>
_FO_GetCopyName ( $sPath [, $iMode=0 [, $sText='Copy']] )

Parameters

$sPath The full path to the directory or file
$iMode [optional] How to add an index
    0 - Standard, similar to creating a copy of a file in Win7 (default)
    1 - Append index to copies _1, _2, and so on.
$sText [optional] The text "Copy" can change depending on localization

Return Value

Success:Returns the path of the file copies

Remarks

The function does not return an error, because returns a row back (if the file does not exist), or the correct name.

Example

; AZJIO
; http://www.autoitscript.com/forum/topic/133224-filesearch-foldersearch/
#include <FileOperations.au3>

ShellExecute(@HomeDrive) ; open the disc to see the creation of new files
Sleep(400)
$iMode = 0
For $i = 1 To 6
    If $i > 3 Then $iMode = 1
    ; creates on disk 6 copies of files. Three copies for two modes
    $sPath = _FO_GetCopyName(@HomeDrive & '\I am the new file.txt', $iMode)
    FileWrite($sPath, '1') ; file creation
Next