The problem of long paths in backups (Copy mode in APBackup).

In Windows, the maximum length of a file name is defined as MAX_PATH = 260 characters. In the APBackup copy mode, however, the resulting length of an archived file can exceed this limit – and this can cause a problem.

Backup copy mode

In this case, the APBackup task will be terminated with one of the following errors:

Can not create destination file: [EID:3:Path not found...
Can not create destination file: [EID:206:The filename or extension is too long:...
Can not create destination file: [EID:3:The filename or extension is too long:...

For instance, a task copies folder C:\Documents and Settings\User\*.*
to a backup archive called D:\Backup\Backup_2011\Daily_Backups\January\Profile
In this case, a source file with a name slightly shorter than 260 characters – “C:\Documents and Settings\User[210_symbols_path]example.txt” – will be copied to a file called “D:\Backup\Backup_2011\Daily_Backups\January\Profile\Documents and Settings\User[210_symbols_path]example.txt” and its final length will exceed 260 characters. This APBackup task will be terminated with an error.

There are several ways to avoid this situation:

1. Sometimes it turns out that files with such long names in the source location are not needed. For instance, these can be various temporary or cache files. In this case, termination of the task because of such a file is highly undesirable or the archive must be created regardless of these problems and even if some files are lost in the process.
For such cases, APBackup has a special option on the [Source] tab: “Skip files with too long destination name”.

If you enable this option and a long path situation takes place, APBackup will add a warning with the name of the source file to the log, will skip this file and will resume the execution of the task. In this case, the task will be completed and the names of skipped files will be written to the APBackup log. By the way, APBackup can email the log for a specific task to the admin after the completion of the task.

2. Another method is to shorten the path to the resulting file in the destination folder. You can shorten the archive path – in this example, shorten the “D:\Backup\Backup_2011\Daily_Backups\January\Profile” path. You can also uncheck the “Store full source path on copy” option on the [Source] tab.

If this option is enabled, the full path to the source file will be saved, starting from the root of the drive.
In our case, the following will be saved: “Documents and Settings\User”:

D:\Backup\Backup_2011\Daily_Backups\January\Profile\Documents and Settings\User[210_symbols_path]example.txt

If you enable this option, the path will be saved only from the source folder – that is, the “Documents and Settings\User” part of the file name will not be saved.

D:\Backup\Backup_2011\Daily_Backups\January\Profile\[210 symbols path]example.txt

This is how you can use the second method to nearly completely exclude the possibility of an error arising during task execution. If the second method doesn’t work for some reason, use the option that allows skipping files with long names without stopping the execution of the task.

Related links:

MSDN: Maximum Path Length Limitation
APBackup: backup creation modes.