Destionation folder, ignore Environment Variables?

Get help for specific problems
Posts: 5
Joined: 26 Mar 2023

fuba82

Hi there,

i try to add this as Destionation folder:
D:\!Backup\FFS\%appdata%
but FFS always expand the Environment Variable

any chance to prevent this?
Last edited by fuba82 on 26 Mar 2023, 17:57, edited 1 time in total.
User avatar
Posts: 2288
Joined: 22 Aug 2012

Plerry

Not clear what your problem is:
%appdata% always resolves into something like C:\User\[UserName]\Appdata\Roaming.
So, when used like you describe, it will always include the C:\ part and cause your definition to fail.

If your intention is to define a single FFS sync configuration for different users, you should probably use the Environment variable %UserName%, as described here.
And then define your sync location as something like
D:\!Backup\FFS\%UserName%\AppData
Posts: 5
Joined: 26 Mar 2023

fuba82

It is very clear ^^

I want to create a folder structure that looks EXACTLY like this:
D:\!Backup\FFS\%appdata%\blabla
or this:
D:\!Backup\FFS\%username%\blabla
or more detailed, i want to create a directory/folder named
%appdata%
or
%username%
as a SubFolder of this path
D:\!Backup\FFS\
User avatar
Posts: 3611
Joined: 11 Jun 2019

xCSxXenon

Create the location and then use "browse" to select it in FFS
Posts: 5
Joined: 26 Mar 2023

fuba82

Create the location and then use "browse" to select it in FFS xCSxXenon, 26 Mar 2023, 16:28
already tried and it does not work, the %appdata% will also be expanded when browse the folder
User avatar
Posts: 2288
Joined: 22 Aug 2012

Plerry

OK, so now it is clear what you want.
In the Windows command line, you can escape the special meaning of the % character by escaping it by itself, so %%. Not sure if that also works like that in FFS, but it does not hurt to try.
So, try typing e.g.
D:\!Backup\FFS\%%appdata%%\blabla
directly as your right-side base location.
Posts: 5
Joined: 26 Mar 2023

fuba82

OK, so now it is clear what you want.
In the Windows command line, you can escape the special meaning of the % character by escaping it by itself, so %%. Not sure if that also works like that in FFS, but it does not hurt to try.
So, try typing e.g.
D:\!Backup\FFS\%%appdata%%\blabla
directly as your right-side base location. Plerry, 27 Mar 2023, 06:55
yeah, I know that, tried that and... it does not work ^^

i've tried everything like %%, \%, .%, !%
all of it does not work!

I'm now working on a command-line script with robocopy to get around this but very sad it does not work in FFS 😢
User avatar
Posts: 3611
Joined: 11 Jun 2019

xCSxXenon

Did some testing, I can't figure out how to get it to work either. I would say that using "%" in a folder name is a horrible idea, but it is a perfectly valid folder name.
Posts: 5
Joined: 26 Mar 2023

fuba82

Did some testing, I can't figure out how to get it to work either. I would say that using "%" in a folder name is a horrible idea, but it is a perfectly valid folder name. xCSxXenon, 28 Mar 2023, 14:38
Well...
For Backup solutions, it is DEFINITELY NOT a "bad idea" at all!

For example, you have Backups in the following Folders:
%appdata%
%localappdata%
%programdata%
%userprofile%
and so on...

Manual Example:
• Click the Folder (%appadata%)
• Press "F2"
• Press "CTRL + C"
• Press "Enter" 2x
• Press "Win + R"
• Press "CTRL + V"
• Press "Enter"
• Press "Alt + Tab" (Switch back to Backup Folder)
• Press "CTRL + A"
• Press "CTRL + C"
• Press "Alt + Tab"(Switch back to %appdata%)
• Press "CTRL + V"
• Done, Restored Backup!
This takes me about ~3-5 seconds for each folder!

Or maybe an automated Example:
Create a Batch-File, loop through Backuped Folders, copy the "folder name" (= destination folder), and paste.

Example Code:
@echo off
cd /d %~d0%~p0
for /D %%i in (*) do start %%i
pause
This will automatically open all "destination" Folders by the name of the Source Folder and can easily be used to restore all contents to the "right" folder, just by the source folder names!

AND as you already said:
it is a perfectly valid folder name
So this is a Bug that needs to be fixed anyhow, because... reasons 😁
Posts: 944
Joined: 8 May 2006

therube

Will the Hint: work for you?

go.bat:
set XFFS=C:\out\%%appdata%%
set x
pause

C:\FreeFileSync\FreeFileSync.exe -dirpair C:\out\mov %XFFS%
pause
https://freefilesync.org/manual.php?topic=macros


(You need to use %% in the SET so that %appdata% doesn't get expanded.)
User avatar
Posts: 3611
Joined: 11 Jun 2019

xCSxXenon

This should work natively in FFS if it's a valid path