Sync Script with Background Processing?

Discuss and share scripts and script files...
Post Reply
Jim-W
Posts: 9
Joined: 28 Aug 2018 09:29

Sync Script with Background Processing?

Post by Jim-W »

A simple script to sync two folders but I can't find how or if it's even possible to run a sync script in the background.

sync "D:\Test", "D:\_Test", 1, 0, 1, "cp";

Is there a switch or something? I have Background Processing enabled in Configuration > File Operations.

Any help would be appreciated.

Thanks

J

highend
Posts: 13277
Joined: 06 Feb 2011 00:33

Re: Sync Script with Background Processing?

Post by highend »

There is no way apart from e.g. invoking a second instance of XY together with this script...
One of my scripts helped you out? Please donate via Paypal

Jim-W
Posts: 9
Joined: 28 Aug 2018 09:29

Re: Sync Script with Background Processing?

Post by Jim-W »

I try this, and still not in the background.

Code: Select all

"C:\Program Files (x86)\XYplorer\XYplorer.exe" /script=SyncTest

highend
Posts: 13277
Joined: 06 Feb 2011 00:33

Re: Sync Script with Background Processing?

Post by highend »

Em, your current working instance isn't blocked anymore... You won't get more "background processing" than that
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Sync Script with Background Processing?

Post by klownboy »

To run in a second instance of XYplorer, you'd have to run a command like the following. It depends on whether you are running a script file or running script commands.

Code: Select all

run "cmd /c <xy> /new /win=tray /script=""::sync 'D:\Test', 'D:\_Test', 1, 0, 1, 'cp';if(get('instance')=='2') {exit 'n';}""", , 2, 0;
You may have to get rid of the "c" and "p" switches since it's running in the background. You could also get rid of the "/win=tray" parameter. Take a look at the help file under Configuration | Command Line Switches. If you have the sync command in a script file you can call the script file as shown in Help.

Code: Select all

 run "cmd /c <xy> /new /script=""C:\Zen\sync_test.xys""", , 2, 0;
You don't have to use the "cmd /c" shown there, but I've had better script experiences going that route especially if you don't care to see the second instance.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Jim-W
Posts: 9
Joined: 28 Aug 2018 09:29

Re: Sync Script with Background Processing?

Post by Jim-W »

I guess I just don't get why you can run a manual sync in XY and while sync is running you can close XY and the sync/XYCopy keeps running.

When I use /win=tray, the buttons on the sync dialog don't work (Pause, Cancel, X).

I'll find another solution.

Thanks for your help!

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Sync Script with Background Processing?

Post by klownboy »

Because of the dialogs involved with sync, I didn't think you'd be able to use /win=tray that why I mentioned getting rid of that command line switch.

By the way, in Configuration | File Operations | Background Processing, do you have that checked (along with Queue file operations), and under the Apply to... have Sync operations also checked? I don't use background operations myself in this case, but you may want to try enabling it and see if, with syncing files in progress, you can continue do normal XY operations...that's the whole idea.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Jim-W
Posts: 9
Joined: 28 Aug 2018 09:29

Re: Sync Script with Background Processing?

Post by Jim-W »

Background Processing and Queue file operations are checked.

I have found that "Backup" works as expected from a script but Sync does not.

This looks like a bug or XY Sync just won't work for me.

Thanks

Post Reply