Hello,
You can select right.orphan.files then delete right, but since script does not offer any preview or Undo, I recommend testing on test folders first to prevent losing any live data.
However, I'm not sure that's the best solution. If the dates are not maintained on the server automatically, you could perform a Touch manually after the copy (in either direction) to re-set the date. This can be done with another select command (perhaps after a binary compare, then select all.equal.files?), then using the touch command. For details on the syntax, please see the Help file -> Scripting Reference.
In the session "admin" in the graphical interface, in the Session Settings, Handling tab, we do have an option to automatically set the timestamps of the local files from the server (for servers that do not support maintaining or setting the timestamp). If this option is enabled in the Session, it would be loaded in the script as well. This would keep the timestamps in sync (although newer).
I would recommend stepping through the graphical interface first, to determine which steps/logic you'd like to use. This way you can visually see the comparison and how each script command would then interact (as each command generally resolves to a specific click or selection in the graphical interface).
Announcement
Collapse
No announcement yet.
Auto Sync in Folder Sync
Collapse
X
-
Sync to FTP via command line
I am syncing to an FTP site and that causes issues with the dates on the files. My current command is this
load "admin"
sync mirror:left->right
but the local files are now much older than the remote files because the ftp site doesn't maintain the date. This causes a prompt to ask about overwriting. I see from the last message that it can be broken out like this
expand all
select left.newer.files
copy left->right
How would I remove files on the right that have been deleted on the left for a true sync?
Thanks
Leave a comment:
-
Hello,
You must still load a Folder Compare, which can cover all of the sync cases in script, but is a bit trickier to setup. Instead of using the Sync:Update or Mirror commands, you instead use a series of selection and copy/delete commands to achieve the same actions as the sync.
What is your current Folder Sync session configured to perform? We can then help with a script that would perform the same series of actions.
It is important to remember that script is executed sequentially. You can have multiple select and copy commands, in order of execution.
expand all
select right.older.files
copyto base "c:\backup"
select left.newer.files
copy left->right
Leave a comment:
-
Originally posted by Aaron View PostIt still isn't possible to load a Folder Sync session, but you can load a Folder Compare session. You can also convert a Folder Sync session to a Folder Compare session using the graphical interface. First, load the sync session. Then in the Session menu -> Compare base folders. This opens a new tab with the folders and most session settings already set up as a Folder Compare session type. Save this session, then use your first script example to load it by name, and perform the sync command.
Aaron/Scooter Staff,
Sorry to bounce an old post but I am wondering if this was ever resolved and you can run Folder Sync sessions from the Task Scheduler now? Doing a folder compare doesn't seem to cover all the "Sync/Action/Presets:" unless I'm missing something.
Please enlighten,
Brian
Leave a comment:
-
Hello,
Sync Update will copy any Newer or Orphan files in the direction of the sync. I would recommend first loading the graphical interface and load your two folders in the Folder Sync or Folder Compare session. This would let you preview how the comparison is running and which files are marked as Newer and Orphan. Once the sync is working there as you expect, we can then help with the script that will run the same type of sync.
I would suggest testing with sample or test files, since our sync, copy, delete, etc actions are not Undo-able.
Leave a comment:
-
Does this sample script actually sync?
Regardingthe sample script above, will this sync everything from left to right, and does it include subfolders? I just ran it and it didn't seem to actually sync, it finished in a little over a second.
Thanks, Bon
Leave a comment:
-
A Folder Compare is a session type designed for viewing and comparing a pair of folders and all of their content. There are many, many options for narrowing the view and directly interacting or taking action on a specific selection. Sync tools are a small subset of the Folder Compare.
A Folder Sync session takes the commonly performed sync action and makes it its own session type. It provides a Preview pane that updates in real time to show which files the sync will interact with and how. The Sync is always on the entire folder, and does not use the current selection. The sync is designed as a quick/easy preview with a one-button "Sync now" solution to easily setup and sync files/folders without extraneous options that do not directly impact the sync.
Leave a comment:
-
Originally posted by Aaron View PostIt still isn't possible to load a Folder Sync session, but you can load a Folder Compare session. You can also convert a Folder Sync session to a Folder Compare session using the graphical interface. First, load the sync session. Then in the Session menu -> Compare base folders. This opens a new tab with the folders and most session settings already set up as a Folder Compare session type. Save this session, then use your first script example to load it by name, and perform the sync command.
What's the meaning for 2 different kind of session types?
Thank you!
Best regards,
Camillo
Leave a comment:
-
It still isn't possible to load a Folder Sync session, but you can load a Folder Compare session. You can also convert a Folder Sync session to a Folder Compare session using the graphical interface. First, load the sync session. Then in the Session menu -> Compare base folders. This opens a new tab with the folders and most session settings already set up as a Folder Compare session type. Save this session, then use your first script example to load it by name, and perform the sync command.
Leave a comment:
-
So it seems like this still has not been resolved as I saved a sync session, and then want to load it in my script via the load command and still get the "Loaded session must be Folder Compare session". (using v 3.3.1)
Thats a limitation of sessions.
So I take it the only way to script this sync is to just do all of the sync stuff explicitly in the script after loading the default session:
So while it would be great to be able to do:log normal C:\temp\BeyondCompare-Sync-Log.txt
load "SyncProjFolders"
sync update:all
What we have to do (since the saved sync session called SyncProjFolders is a sync session).. is use the default session and explicitly define the stuff that would have been saved in the session:
log normal C:\temp\BeyondCompare-Sync-Log.txt
load <default>
filter "-*.o;-*.lo;-*.la;-*.al;-.libs;-*.so;-*.so.[0-9]*;-*.a;-*.pyc;-*.pyo;-*.rej;-*~;-#*#;-.#*;-.*.swp;-.DS_Store;-*.ncb;-*.suo;-*.obj;-*.idb;-*.*.*.user;-Debug\;-Release\;-Debug-*\"
load C:\_Projects E:\
sync update:all
Last edited by Minok; 24-Aug-2011, 05:19 PM.
Leave a comment:
-
Hi Tom,
It is possible to automate a synchronization, it just isn't easy in the current BC3.0.15. Making it easier is the new feature I was talking about.
In BC3, it isn't possible load a saved "Folder Sync" session in a script. If you load the folders in the "Folder Compare" and save it, you can load the saved Folder Compare session in a script.
Once you have the script working, you can schedule it using the Windows Task Scheduler.
Leave a comment:
-
Team Scooter,
After reading this forum I am a little lost. On the one hand we have Aaron showing a sample script that answers the question of Auto Sync in Folder Sync, but then we have Chris saying this will be a new feature. Which is it?
I tried to perform the script shown by Aaron and I get the same error message:
Loaded Session must be Folder Compare Session.
Did anyone figure out a way around this?
the script i tried:
log verbose "c:\autosync\autosync_log.txt"
load thumphrey_backup
sync update:lt->rt
Leave a comment:
-
dbrower,
Thanks for the suggestion. Making it easier to schedule syncs is on our list for a future version of Beyond Compare.
Leave a comment:
-
I just got tripped up by this, too. Happily, I found this answer in just a few minutes, thanks to this forum! Since the command line accepts the sync session name, I think we only lack a command switch like /autosync and that would do the trick: bcomp /autosync "MySyncSession"
Leave a comment:
-
There aren't separate script commands for folder sync sessions, so you'll need to save a folder compare session to load in your script.
Leave a comment:
Leave a comment: