• New Backup Project (AutoItv3 Script)

    Home » Forums » Developers, developers, developers » DevOps Lounge » New Backup Project (AutoItv3 Script)

    • This topic has 12 replies, 4 voices, and was last updated 14 years ago.
    Author
    Topic
    #476120

    I’m creating a script in AutoIt to use some of the software on my computer to create a new method for backups. I’ll be doing research off and on to find solutions to these questions but I still want to post here in case someone else either beats me to the answer or finds a solution before me. So, I’m just going to list what I’m looking for:

    A command to save a configuration file from COMODO filewall. I use the Proactive security mode and am looking for the proper command (not just to copy the appdata folder as I’ll be doing that anyways and it’s not as versatile).
    I’m still looking into this.

    A command or script to save all of my iTunes Playlist. I manage multiple computers and we all share music (I rip all CD’s on my computer, copy them to my External, then copy that to other computers so everyone has access to all of our collective music in my house).
    Got enough data, I’ll open iTunes, activate the window (which also waits for the window to be active), press a series of keys to export my library.

    A command or script to copy files using the current system default (I want to use SuperCopier2 to copy the files because of some of it’s abilities and settings, the settings are already set up).
    Since I can’t get it to work with SuperCopier directly I’m going to work through Windows Explorer and make my script copy normally (I was hoping for a more direct method but this will have to do).

    A command to save the output of a tree (I believe the term is piping the output to a file but I’ve not any real experience with this). (To clarify by tree I mean the tree command that list all files and directories under the source).
    Still looking for this.

    A command to convert that file (or rather files) for use in the next step. Essentially I need a quick and guaranteed way to rename each line in the file. (more below)

    A way to compare two text files and create a file with everything in one that’s not in the other.

    A command (or rather script) to delete files that are in a list in a text file.

    The last three parts the idea is that I’ll compare a tree listing of my local folders compared to the backup folders and if anything resides on the backup that’s not on the local copy I’ll delete it. This accounts for files that were renamed or deleted (shouldn’t be too many renames so I’m not to worried about the extra tax on my hardware)

    For the last part if anyone knows of a way to simply rename files that were renamed (other than using SyncToy as that’s my current solution and it seems to be missing the ability to use shadow copies, as far as I know SuperCopier2 is fine with using shadow copies) it would be much appreciated. (I’ll still have to do the last part or something like it to deal with deleted files and I want to have a file containing a tree of my drive in case something ever happens like it did recently and I lost my backup drive (plus all the other stuff I keep on there and no where else due to space restrictions).

    Viewing 6 reply threads
    Author
    Replies
    • #1277137

      This is a nice juicy project for you, but I don’t think AutoIt is the right tool. I would be writing this in VB script as it can do all the things you require, except saving the config file in Comodo or the playlists.
      There are plenty of people on the net who can help with VBS.

      cheers, Paul

    • #1277162

      @Paul:
      I probably could do this with VBS but I’m far more familiar with AutoIt and I have an easy way to launch AutoIt as well (I have it in my Jump bar so I just right click and select a pinned script). I’ve been slowly working on finding info for this and thus far I’ve found only that there is no command line function for SuperCopier 2 and there isn’t likely to be any soon. As such I’ve posted on the AutoIt forums (which I’ll probably post some more to in the near future) in hopes someone will be able to give me a GUI code to do the trick (AutoIt can select things based on Window titles so there should be some way to do it).

    • #1277884

      I’ve made some progress with this. I’ll edit the first post with the details.

      Edit: OP has been modified, what I’m looking for now (other than the Comodo thing) is a command to create and save a tree to a certain location (I think piping is used for this purpose but I don’t really know how to do that).

    • #1277890

      What you want is:

      TREE [drive:][path] [/F] [/A] > [drive:][path]filename.ext

      Switches:
      /F Display the names of the files in each folder
      /A Use ASCII instead of extended characters

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

      • #1277902

        Thanks, Now I need to convert this to a format that includes the full file path of each file (for example: “C:Program FilesCCleanerCCleaner.exe”). With or without quotes (I should be able to remove the quotes if need be quite easily). Once I have that I’ll need to convert from there to a format replaces C: or B: with the relative backup location then I’ll need to compare the tree’s of the actual locations to the backup locations (By replacing the C: and B: I’ll be making the local trees reflect their backup locations. This way I can just say to delete any entries that already exist then keep what remains as a list of files to delete (Files that don’t exist on the original and thus don’t need to exist on the backup). So it’s clear this is meant to only keep a single relative backup, not to keep multiple backups of each drive.

        What you want is:

        TREE [drive:][path] [/F] [/A] > [drive:][path]filename.ext

        Switches:
        /F Display the names of the files in each folder
        /A Use ASCII instead of extended characters

    • #1278743

      I’ve done some research and found that instead of Tree “dir [drive] /b /s > [location]” actually works a bit better (it already puts the files in the proper list format) but, I’ve found a problem with this approach. When listing the files it will repeatedly open the shortcut for “Application Data” which is somewhat recursive as it brings you back to the same folder except Windows detects it as “C:UsersGregApplication Data” thus when dir tries to follow the link it will eventually get “C:UsersGregApplication DataApplication DataApplication DataApplication DataApplication Data” until it’s too much for it to handle and it quits. Obviously this prevents me from getting a clean list and from spotting any other potential issues. I’m betting the same thing probably happened in tree but I just didn’t notice it. The exact error is (without showing the actual path): “The directory name [drive:path] is too long.”

      I’ve already tried to ignore recursive’s but it apparently isn’t a recursive so that didn’t work.

      I’m going to continue looking for a fix but would be happy enough if someone else beat me to it.

      • #1278873

        I’ve already tried to ignore recursive’s but it apparently isn’t a recursive so that didn’t work.

        If you open cmd and navigate into your C:UsersGreg folder, it appears you can select or exclude the magic pointers using the “L” attribute.

        Code:
        dir /aL
        
        dir /a-L

        I don’t know whether AutoIt uses the same parameters.

        • #1278941

          I’ve confirmed using your addition that it’s not a recursive file. I still get the same error and results in the end file like: “C:Documents and SettingsAll UsersApplication DataApplication DataAdobe” My command (in a command line) was: dir C: /a-L /b /s > “C:UsersGregLocal BackupsListC.txt”

          If I could ignore shortcut files (or ignore the extension .lnk) then I could avoid this issue but there doesn’t appear to be an option for this.

          The ‘folder’ “C:Documents and SettingsAll UsersApplication Data” is actually a shortcut back to “C:Documents and SettingsAll Users” so it just loops continuously. Also since it’s obviously following this shortcut that also means that any other shortcuts to folders will be followed.

          I’ll include a couple text files in my next post that may help.


          @RetiredGeek

          I’m not sure why your code works and mine doesn’t. You did type the same thing I did.

          Again I’m referring to a command line code. The AutoIt script will just execute it like a batch file would.

          If you open cmd and navigate into your C:UsersGreg folder, it appears you can select or exclude the magic pointers using the “L” attribute.

          Code:
          dir /aL
          
          dir /a-L

          I don’t know whether AutoIt uses the same parameters.

          • #1278942

            The files attached are the output from the command line (hence the name) and part of the outputted ListC.txt (the full file is far to large to upload and the only method I know of to split it up would be RAR compression which doesn’t appear to be accepted.

    • #1278752

      dir [drive] /b /s > [location]

      I tried this and it worked flawlessly! I listed my G: drive to my V: drive

      Did you by any chance have [location] somewhere within the currently active folder, e.g. [drive]?

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

      • #1278758

        I tried this and it worked flawlessly! I listed my G: drive to my V: drive

        Did you by any chance have [location] somewhere within the currently active folder, e.g. [drive]?

        Since this is a backup project I need to make a list of my entire C: drive. An example error:

        The directory name C:Documents and SettingsAll UsersApplication DataApplication DataApplication DataApplication DataApplication DataApplication DataApplication DataApplication DataMicrosoftWindowsStart MenuProgramsMicrosoft Visual Studio 2010Microsoft Windows SDK Tools is too long.

        As you can see it follows “Application Data” a shortcut that leads back to the same folder (don’t know why but apparently this is needed for Windows to work correctly) until the name is too long for even the largest buffers (which I set my buffer to the max size).

    • #1278778

      You may have a problem with your file structure.
      I tried it on my entire C: drive again w/o problem. See below.

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    Viewing 6 reply threads
    Reply To: New Backup Project (AutoItv3 Script)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: