Automated File & Folder Backups and Synchroniztion

Support for xplorer² free lite version

Moderators: fgagnon, nikos, Site Mods

JDN
Member
Member
Posts: 41
Joined: 2004 Nov 30, 05:27
Location: Toronto

Automated File & Folder Backups and Synchroniztion

Post by JDN »

I would love to develop an automated tool that would run every few minutes and backup a list of specified files and folders and copy them to a floppy or USB drive - providing they are now out of sync and need to be re-synched.

It's kind of an automated backup tool - except that it runs when you want and backs up only those files that you want (possibly every 15 minutes or at other regularly scheduled times).

It occurs to me that someone could probably write a special app to do this and that perhaps someone already has. But it also occurs that this could probably be done using X2 with its synchronization features together with the Windows Scheduled Task facility and either a scripting facility - or a hotkey manager. It just may be possible that X2 already provides most of the necessary tools to do this. I don't have a lot of experience with the VBS scripting language. Can anyone tell me how much control one has over sending simulated mouse and keyboard events? Would the VBS scripting language be the right choice for such a thing? Would it be easy to create a series of keyboard and/or mouse events to get X2 to do the required backups?

I think I can make some small enhancements to my hotkey manager - quite possibly release a pared-down version for this specific purpose. I find the prospect very exciting. It's something I've been wanting very much for a while now and for anyone who simultaneously works on a number of files, it would be a wonderful resource because it would release people from the strain of having to keep track of whether or not they are currently sufficiently "backed up". Nikos wrote a paragraph about this somewhere. Dang. I can't find it anywhere now.

I would create a Scheduled Task using the Scheduled Task service found in the Control Panel or in Start-Programs-Accessories-System and then have it run every few minutes. When it ran it would have to start X2 from a "stable state" or place it into a stable state. What do I mean by that?

I read that X2 can start with a specific registry parm variable and that it would use the configuration info contained there. Then, once X2 terminates, the info is retained and retrieved the next time it is run using the same registry variable. The command line might look like this:

C:\PROGRAM FILES\XPLORER2_LITE\XPLORER2.EXE " C:\ D:\ /S:STATE_1"

In this command line, the registry variable is called "STATE_1" and the idea is that all config-type info (like the names of the columns displayed or the size and position of the window and its panes and its columns) is stored in the registry under that key.

My problem is that when I start X2, I need to know whether it starts with one pane or two panes showing. I don't care which. I just need to know which so that I can start my macro or script at the correct starting point.

So, here is the problem. Is it safe to rely on this registry variable and is there any way to ensure that it starts with a known stable state so far as one pane or two? Either way is fine, as long as I know which. I tried to use the command line as you see it and it worked perfect for a while but lately it seems to ignore the two folders provided.

In thinking more about it, I'm not really concerned about the folders - just want to let you know that I am experiencing this problem. But if I can use the registry variable with confidence, I have a good shot at being able to keep two panes always and even after X2 terminates, I can open it using that same registry variable and be confident that it will open with two panes (although I can't be sure which two folders will be contained in the two panes).

The alternative is that anyone using this tool, will have to know they are responsible for making sure they open X2 using a specific registry variable and then setting it to contain two panes and then close it so that I can be certain it will always contain two panes from that time onward.

This likely doesn't seem very important to you. It's just that for the sake of clarity, we need to be certain as to the state of X2 at the time it is run.
User avatar
fgagnon
Site Admin
Site Admin
Posts: 3737
Joined: 2003 Sep 08, 19:56
Location: Springfield

Post by fgagnon »

You should be able to get a guaranteed 1-pane start with a commandline of the form:
"path_to_xplorer2\xplorer2_UC.exe" /P /R:rootfolder /S:layoutkey /T /1 c:\startingfolder
______________________________________________________________________
JDN
Member
Member
Posts: 41
Joined: 2004 Nov 30, 05:27
Location: Toronto

Post by JDN »

Thank you very much, FGagnon.

I had been working under the mistaken assumption that the 2X command line parms were still in effect. The current version is a terrific improvement and a big help. Now I can be confident that the command line parms will not impact my ability to produce this automated tool.

Does anyone have any suggestions or requests before I get started?

I will start to look into it. In the meantime, can anyone let me know if they are using any other kinds of tools to automatically do backups?

I would greatly appreciate any other info on scripting languages that anyone can suggest - especially if anyone has a good idea of the kinds of keystroke events and mouse events that can be sent in the VB Scripting language
User avatar
nikos
Site Admin
Site Admin
Posts: 16296
Joined: 2002 Feb 07, 15:57
Location: UK

Post by nikos »

windows scripting isn't really a language, it is just a means to automate applications and object models through their public interfaces. So it is unlikely that it will have a direct means to send input to programs, but if you find an object that exposes such functionality then you'll be able to use it through VBS. This is a huge topic, see for more:
msdn library: scripting

scriptable objects relating to file management
msdn library: scriptable shell objects

{tagged URLs with text aliases to reduce display width  -fg-}
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

JDN wrote:[...]Does anyone have any suggestions or requests before I get started?
[...]
Yes, I have. Before you bend over backwards to do this using X²!
In stead have a look at Second Copy 2000. You'll find that this little gem does exactly what you have in mind (it's shareware though; quality has a price :) )

8)
Dumb questions are the ones that are never asked :turn:
JDN
Member
Member
Posts: 41
Joined: 2004 Nov 30, 05:27
Location: Toronto

Post by JDN »

Thank you JRz. I will have a look at it.

The idea was to provide something that could be either incorporated into X2 or made available as an option alongside X2. In both cases, I'd like to make something available to X2 users for free.

There are many reasons to do this. One is to stimulate discussion of the kinds of automated support people want when using an app like X2.

The interesting thing about this "automatic backup" facility is that the key concepts are very small and (knock wood) simple. So I will be happy to look at Second Copy 2000. But if I can provide some kind of similar functionality (even if it is not perhaps as deluxe as a paid version) it would be a great source of peace of mind.

Consider the poor tortured soul that wrote this:

Personally, I have suffered so many devastating blows during my long-term symbiosis with computers, that have developed a nearly-psychotic tendency to backup every piece of important working file. Note that I am not referring to once a month - or even weekly - backups; if some dark cosmic eventuality causes my losing even one hour's worth of work I feel gutted. It is the well known universal law of the sod that things will pack up the very moment that absolute reliability is at a premium. The text editor will delete the thesis you were working on, the developer studio will crash and corrupt your C++ source files, even the operator himself is liable to malfunction after long hours and do the daft thing. These are all too familiar sights that are capable of driving even mother Teresa through the wall, if under pressure.

The answer to these kinds of hiccups is to do frequent "backups" onto a floppy disk, at a rate inversely proportional to your insecurity factor - that's every 10 minutes if your name is Nikos. For that purpose you need a very efficient and fast tool that can automatically detect the files you've modified and quickly copy them to their secure haven. Well, you've guessed it, 2xExplorer does just that with a variety of synchronisation commands.

It is so traumatic to work hard for an hour or so and finally get a tricky bit of software working - only to hit the wrong key by mistake and lose it all.

It would be such a beautiful thing to hook up my USB drive to the machine and every 5 minutes or so, a silent automated process would make a backup for me and keep me protected. I've been wanting this for a long time.

So, if I write something for myself and make it available for free to all X2 users, it would be another good reason to attract people to X2 - kind of like a free unexpected bonus that fits in well with X2's concept of file synchronization.

I will try to look at Second Copy within a day or two. Thank you, again.
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

I'm too tired from reading your post to write an answer right now. Have to take a break first ;)
Dumb questions are the ones that are never asked :turn:
JDN
Member
Member
Posts: 41
Joined: 2004 Nov 30, 05:27
Location: Toronto

Post by JDN »

I have downloaded Second Copy and have worked through it. It appears to be a very well written product.

There are some interesting things to consider:

First, it is $30 US which makes it more expensive than X2 PRO.

That is interesting because it should be possible to get X2 PRO to perform a similar function to Second Copy (perhaps when used together with some scripting, macro or hotkey manager). Of course I'm not suggesting that X2 Pro could do everything that SC could do. But I'm guessing it could do enough to satisfy my needs.

This is not a knock against SC. It is, rather, a salute to the value of X2 PRO - that it can do much of what a standalone app can do as part of its builtin functions. If that is true, I would find that to be remarkable.

I would extimate that the work required to build and maintain X2 PRO to be at least ten times as much as Second Copy - maybe much more. This is just a rough estimate based on my experience as a software engineer and guaging an understanding of what is required to perform the functions of Second Copy. I would guess X2 PRO has approx 10,000 to 15,000 lines of source code.

So I will continue to investigate just how much can be done by using X2 and a hotkey manager. I'm confident that I can get X2 to backup my files every few minutes by using one or two other existing tools and having them work together.
Last edited by JDN on 2004 Dec 10, 12:07, edited 3 times in total.
User avatar
nikos
Site Admin
Site Admin
Posts: 16296
Joined: 2002 Feb 07, 15:57
Location: UK

Post by nikos »

have you ever timed yourself? I bet you're in the 500-WPM typing league :)
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

JDN wrote:OK. But I'm only willing to take half the blame.
:wink:
fair enough  :lol:
Dumb questions are the ones that are never asked :turn:
JDN
Member
Member
Posts: 41
Joined: 2004 Nov 30, 05:27
Location: Toronto

Post by JDN »

Heh. I wrote a Speed Typing app that works by enabling people to press multiple keys on a keyboard simultaneously.

It is akin to the kind of machines that court reporters and legal stenographers use but it works with ordinary PC keyboards.

Given that it can produce entire words and phrases with a single keypress (often comprised of multiple keys in the same stroke), the speeds can be quite astonishing. But I don't want to bore anyone with that here.
JDN
Member
Member
Posts: 41
Joined: 2004 Nov 30, 05:27
Location: Toronto

This project is "on hold" for the time being.

Post by JDN »

After further study, I have come to the following three conclusions:

1) For people who want to frequently make backups of files and folders where the files and folders can vary, Xplorer2 is ideal.

2) If over a fairly long period (say a few weeks or months), you are working on the same set of files and folders, then there is no reason why you can't just use a batch file containing the "replace" command and create a scheduled event. It takes about the same time and trouble as Second Copy but offers a little more flexibility and it's free.

3) It's worth buying Second Copy if you have very little technical experience and just want a tool to do the job for you while allowing you to work on the specifics of your project. In other words, you don't want to spend any time learning about some new app unless it is absolutely necessary.

Here is a batch file I use to backup the files I am working on:

@c:
@cd\
wzzip -r -p -wHS -xc:\pp\blu\*.exe  c:\pp\blu\jdnxxp.zip  c:\pp\blu\*.*
replace /u c:\pp\xp\*.*   a:\pp\xp
replace /u c:\pp\blu\*.*  a:\pp\blu
replace /u c:\pp\m\*.*    a:\pp\m

Note that this example enables me to zip one folder and save it while it saves specific files from other folders - only if they are "newer" than the version on the saved drive. Using a compression tool like "zip" enables me to use a floppy to backup a large amount of data. I suppose a modern USB drive contains 512 or 1,024 gig and can be used to backup without having to worry about compression.

I wonder if my situation is similar to yours. Over a period of a few weeks or months, I tend to work on projects involving a few diferent folders. Some of the folders contain a large number of files, but I only ever change a handful of files in any one folder. Some folders may be too big to fit on a floppy. But the total of all the files I work on (source programs, documentation, correspondence) will, by their very nature fit on a floppy. What I mean by this is that an individual working on a large project can only fit so much in their mind at once. So even though you may be working on a project that is made up of a huge set of files, you will only be working on a small subset. So, the third approach above seems perfectly fine to me.

If you are comfortable with Windows commands, like the "replace" command, the /u parm means that files in the target folder will be replaced by files in the source folder only if the original contents have been changed.

There is also a /a parm which means that files that exist on the source but not on the target will be "added". So, to handle a very large folder, I copy those files that I want to keep up to date to the floppy and use the "replace /u" command. In that way, only a limited number of files will be written to the floppy. If the folder is much smaller than the size of the target drive (say 1.4 megs for a floppy) then it's easier to just zip the folder and copy the whole thing.

The replace command behaves nicely when copying a group of files from a floppy to a hard drive. It acts as if it is cching the files and only takes a second to start the copy but lets me carry on. Unfortunately, that is not the case when copying from the hard drive to the floppy where it grinds out each file - one at a time.

If anyone knows a good way to copy a group of files from a hard drive to a floppy and take advantage of a disk cache or equivalent, I sure wold love to know how. I used a built-in command called "SMARTDRV" in W98. But unfortunately, it is no longer working (or at least it no longer works for me). It seems so unfortunate to have this hugely fast PC and a modern windowed PC but still have to wait for the file copy to finish before I can carry on with any further work. I'm guessing there must be something I am missing.
User avatar
nikos
Site Admin
Site Admin
Posts: 16296
Joined: 2002 Feb 07, 15:57
Location: UK

Post by nikos »

i was a floppy-happy person till about a month ago
then somebody gave me one of those usb flash memory sticks and i never looked back! faster (not blindingly mind), reliable (to be confirmed), good storage capacity and not too expensive, everybody should be writing to santa for one  :xmas:

another way you can do it -- but you'd need the pro version -- is to do a search once every while for files modified within eg. last day or week. Then you could use the "paste scrap clips" command from edit menu to only copy files that were modified and maintain the folder structure -- useful when you put them on a floppy with the ultimate plan to carry them home or to another PC
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

In general backing up to floppy is not safe, since floppies tend to suffer from the aging process. One day you'll find you can't read the floppy you saved your most precious source files on :(

It's better in my view to make a backup to a different hard disk (if possible) and augment that by using a regular backup strategy to CD/DVD and/or flash memory (the stick Nikos was lyrical about just now).

8)
Last edited by JRz on 2004 Dec 12, 16:03, edited 1 time in total.
Dumb questions are the ones that are never asked :turn:
JDN
Member
Member
Posts: 41
Joined: 2004 Nov 30, 05:27
Location: Toronto

Post by JDN »

JRz wrote:In general backing up t floppy is not safe, since floppies tend to suffer from the aging process.
Very true.

I have also ruined floppies beyond repair with my vacuum cleaner. Strange as it sounds, when I turn the vacuum cleaner on and it passes within about 5 feet from a floppy, the floppy is ruined and I can't even reformat. I guess the magnetic field produced by the vacuum is very strong.

I just use the floppy for immediate recovery and regularly backup to CD-RW.