FreeFileSync Open Source File Synchronization

About Tutorials Screenshots Vision Download Archive Forum F.A.Q. Manual Donate
It looks like an ad blocker has blocked the ads. The FreeFileSync project is 100% dependent on ad revenue and donations to stay alive. Instead of the ads, and after FreeFileSync has proven useful to you, please think about supporting with a donation.
FreeFileSync User Manual:

Macros

All directory paths may contain macros that are expanded during synchronization. The beginnings and ends of each macro are marked by a % character. In addition to special macros handling time and date, the operating system's environment variables may also be used.

Internal Macros

Macro Example Format
%Date% 2016-12-31 [YYYY-MM-DD]
%Time% 112233 [hhmmss]
%TimeStamp% 2016-12-31 112233 [YYYY-MM-DD hhmmss]
 
%Year% 2016
%Month% 12 [01–12]
%MonthName% Dec short name
%Day% 31 [01–31]
 
%Hour% 11 [00–23]
%Min% 22 [00–59]
%Sec% 33 [00–59]
 
%WeekDay% 1 [1–7]
%WeekDayName% Mon short name
%Week% 52      [01–52] calendar week

Environment Variables (Windows)

Macro Example
%AllUsersProfile% C:\ProgramData
%AppData% C:\Users\Zenju\AppData\Roaming
%ComputerName% Zenju-PC
%LocalAppData% C:\Users\Zenju\AppData\Local
%ProgramData% C:\ProgramData
%ProgramFiles% C:\Program Files
%ProgramFiles(x86)% C:\Program Files (x86)
%Public% C:\Users\Public
%Temp% C:\Windows\Temp
%UserName% Zenju
%UserProfile% C:\Users\Zenju
%WinDir% C:\Windows

Special Folder Locations (Windows)

Macro Example
%csidl_Desktop% C:\Users\Zenju\Desktop
%csidl_Documents% C:\Users\Zenju\Documents
%csidl_Pictures% C:\Users\Zenju\Pictures
%csidl_Music% C:\Users\Zenju\Music
%csidl_Videos% C:\Users\Zenju\Videos
%csidl_Downloads% C:\Users\Zenju\Downloads
%csidl_Favorites% C:\Users\Zenju\Favorites
%csidl_Resources% C:\Windows\Resources
%csidl_QuickLaunch% C:\Users\Zenju\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
%csidl_StartMenu% C:\Users\Zenju\AppData\Roaming\Microsoft\Windows\Start Menu
%csidl_Programs% C:\Users\Zenju\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
%csidl_Startup% C:\Users\Zenju\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\StartUp
%csidl_Nethood% C:\Users\Zenju\AppData\Roaming\Microsoft\Windows\Network Shortcuts
%csidl_Templates% C:\Users\Zenju\AppData\Roaming\Microsoft\Windows\Templates
 

Note: Most of the macros above have a variant for public folders, e.g. %csidl_Documents% has %csidl_PublicDocuments%.


Hint: You can add flexibility to an ffs_batch configuration file by creating new temporary environment variables in a bat or cmd file that are evaluated by FreeFileSync at runtime:

Example:

The FreeFileSync batch file C:\SyncJob.ffs_batch contains macro %MyVar% instead of an absolute target folder and is invoked by a cmd file:
set MyVar=C:\Target
"C:\Program files\FreeFileSync\FreeFileSync.exe" C:\SyncJob.ffs_batch
::%MyVar% is resolved as C:\Target during synchronization

Note
Temporary environment variables created with the set command are only valid if the synchronization is started by calling the FreeFileSync executable directly. Using start /wait would create a new program context without these temporary variables.