Macros

All directory names may contain macros that are expanded during synchronization. Begin and end of each macro is marked by a % character. Besides special macros handling time and date, the operating system's environment variables can also be used.


Internal macros:

%date%       e. g. 2012-12-22        format [YYYY-MM-DD]
%time%       e. g. 123044            format [hhmmss]
%timestamp%  e. g. 2012-12-22 123044 format [YYYY-MM-DD hhmmss]

%year%       e. g. 2012
%month%      e. g. 12
%day%        e. g. 22

%hour%       e. g. 12
%min%        e. g. 30
%sec%        e. g. 44

%weekday%    e. g. Monday day of the week
%week%       e. g. 28     calendar week



Environment variables: (Windows)

%AllUsersProfile%   e. g. C:\ProgramData
%AppData%           
e. g. C:\Users\<username>\AppData\Roaming
%ComputerName%      
e. g. Zenju-PC
%LocalAppData%      
e. g. C:\Users\<username>\AppData\Local
%ProgramData%       
e. g. C:\ProgramData
%ProgramFiles%      
e. g. C:\Program Files
%ProgramFiles(x86)% 
e. g. C:\Program Files (x86)
%Public%            
e. g. C:\Users\Public
%Temp%              
e. g. C:\Windows\Temp
%UserName%          
e. g. Zenju
%UserProfile%       
e. g. C:\Users\<username>
%WinDir%            
e. g. C:\Windows




Special folder locations (Windows)

%csidl_Desktop%     e. g. C:\Users\<username>\Desktop
%csidl_Downloads%   
e. g. C:\Users\<username>\Downloads
%csidl_Favorites%   
e. g. C:\Users\<username>\Favorites
%csidl_MyDocuments% 
e. g. C:\Users\<username>\Documents
%csidl_MyMusic%     
e. g. C:\Users\<username>\Music
%csidl_MyPictures%  
e. g. C:\Users\<username>\Pictures
%csidl_MyVideos%    
e. g. C:\Users\<username>\Videos
%csidl_Nethood%     
e. g. C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Network Shortcuts
%csidl_Programs%    
e. g. C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
%csidl_Quicklaunch% 
e. g. C:\Users\<username>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
%csidl_Resources%   
e. g. C:\Windows\Resources
%csidl_StartMenu%   
e. g. C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu
%csidl_Startup%     
e. g. C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\StartUp
%csidl_Templates%   
e. g. C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Templates


Note: Most macros listed here also have a variant for public folders. E.g. csidl_MyMusiccsidl_PublicMusic


Hint:

You can add a great amount of flexibility to batch synchronization (*.ffs_batch) by creating new temporary environment variables in a *.bat/*.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 batch job is started by calling the executable directly! Using "start /wait" or relying on Shell Execute creates a new program context without these temporal variables.