Folder named with week number

Discussion in 'Acronis True Image Product Line' started by Matlox, Apr 16, 2009.

Thread Status:
Not open for further replies.
  1. Matlox

    Matlox Registered Member

    Joined:
    Apr 16, 2009
    Posts:
    8
    Location:
    France
    Hi, I'm Matlox

    I've a licence for True Imager Server 9.

    I've searched in the board but I've not found what i'ma looking for.

    My server is backed up every day.On monday i make un full backup, and the other days i make incrementals.

    For now, when a new week begin, i have 2 choices :

    1 : overwrite last week
    2 : continu incrementals


    I want to save every week in a different folder that is named by the week number or the monday date (today we're april 16th, and the week is number 16, so the folder should be named "16", next week the folder will be "17")

    Is it possible to do something like this ? I don't want to change myself the destination folder everyweek.

    Thanks :D
     
  2. MrMorse

    MrMorse Registered Member

    Joined:
    Jun 12, 2008
    Posts:
    737
    Location:
    Germany
    I don't know "Ti-Server9" but does it have the possibility to run a batch file before the task starts? (Ti Home has this option).

    There you can create the new folder, copy the tib files and delete the tib files from the source path.
     
  3. Matlox

    Matlox Registered Member

    Joined:
    Apr 16, 2009
    Posts:
    8
    Location:
    France
    Ok, i can do this script.

    But i really don't want to move backups. Moving backups means generate network traffic, and in few cases it can corrupts files. Every night all my servers are backing up. And all have to be finished at 7 am.

    Is there a possibility to change every week the save path ?

    Creating the directorys is not a problem, a 3 lines script can make my 52 dirs.

    The real problem is the destination path
     
  4. MrMorse

    MrMorse Registered Member

    Joined:
    Jun 12, 2008
    Posts:
    737
    Location:
    Germany
    Right, MOVING files includes a particular danger.

    The destination path:
    Can you set an environment variable every morning to the correct folder?
    SET TIPATH=......
    Then you have a constant path to the destination (e.g. "X:\%tipath%")
     
  5. Matlox

    Matlox Registered Member

    Joined:
    Apr 16, 2009
    Posts:
    8
    Location:
    France
    Well done :cool:


    I'll just have to update my var once a week and the backups will be fine :D


    Thanks MrMorse ;)
     
  6. MrMorse

    MrMorse Registered Member

    Joined:
    Jun 12, 2008
    Posts:
    737
    Location:
    Germany
    I hope that for you :)

    I can imagine that there is another solution with TrueImage-tools and workflows...
    But with the environment var and the batchfile you have all under your own maintenance.

    have a nice week ;)
     
  7. Matlox

    Matlox Registered Member

    Joined:
    Apr 16, 2009
    Posts:
    8
    Location:
    France
    You're right, I prefer have everything under my own maintenance.

    So that's what i'll do :

    1) a simple batch file to create my folders named with years and weeks numbers

    Code:
    set year=2009
    set week=
    :week
    set /a week+=1
    mkdir %year%%week%
    if /i %week% equ 52 goto :eof
    goto week
    
    2) create a system variable named "weeknumber"

    3) a batch to find week number and update my variable

    Code:
    set /a J=1%DATE:~0,2% - 100
    set /a M=1%DATE:~3,2% - 100
    set /a A=%DATE:~6,4%
    set /a N=(1461 * (%A% + 4800 + (%M% - 14) / 12)) / 4 + (367 * (%M% - 2 - 12 * ((%M% - 14) / 12))) / 12 - (3 * ((%A% + 4900 + (%M% - 14) / 12) / 100)) / 4 + %J% - 32075
    set /a T=(%N% + 31741 -(%N% %% 7)) %% 146097 %% 36524 %% 1461
    set /a WEEK=((((%T% - (%T% / 1460)) %% 365) + (%T% / 1460)) / 7) + 1 
    reg delete "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment" /v weeknumber /f
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment" /v weeknumber /t REG_SZ /d "%WEEK%" /f
    
    4) And then a modify my save path with my var %weeknumber%



    I've tested each scripts separately. They seems to work fine.

    You can also include the first one in the second, and your dirs will be created every weeks and not all at once.
     
  8. MrMorse

    MrMorse Registered Member

    Joined:
    Jun 12, 2008
    Posts:
    737
    Location:
    Germany
    :)
    Great.

    I'm suprised that you use 'reg add/delete' in your batch.
    Good idea...

    Thank you for your posting with the solution/workaround.
     
  9. Matlox

    Matlox Registered Member

    Joined:
    Apr 16, 2009
    Posts:
    8
    Location:
    France
    the reg add/delete is for the environment variable. It is stored in the registry

    But that solution is not working.

    I tried last night to test it.

    First problem, i cannot change my save path to x:\%weeknumber%\save.tib

    TI tells me that "Computer" is not a right path.

    But i can change to x:\%weeknumber%save.tib and then my backup is named %weeknumber%save.tib


    TI don't use systems vars :(
     
    Last edited: Apr 18, 2009
  10. Joa

    Joa Registered Member

    Joined:
    Jan 28, 2009
    Posts:
    7
    That's Acronis!
     
  11. Matlox

    Matlox Registered Member

    Joined:
    Apr 16, 2009
    Posts:
    8
    Location:
    France
    There is no other solution ?
     
  12. Matlox

    Matlox Registered Member

    Joined:
    Apr 16, 2009
    Posts:
    8
    Location:
    France
    Well,

    So we're on the "Official Acronis Support Forum" and i've got no aswer.

    Can you tell me if it is possible or not o_O?

    If it isn't, just tell me that and i'll look for something else, but i need to know !!!

    Thanks
     
  13. MudCrab

    MudCrab Imaging Specialist

    Joined:
    Nov 3, 2006
    Posts:
    6,483
    Location:
    California
    When you're editing the Registry to set the environment variable, shouldn't you be setting CurrentControlSet instead of ControlSet001?

    ---

    I'm not sure about TI Server 9, but TI Echo Workstation will process environment variables when you use the trueimagecmd.exe program to do the backup. (Echo Workstation also throws the "Computer" error message if you try to use the variable in the GUI.)

    For example:

    Create a batch file that contains the backup command:
    Code:
    "c:\program files\acronis\trueimageechoworkstation\trueimagecmd" /create /filename:"d:\[B][COLOR="Red"]%weeknumber%[/COLOR][/B]\myenv.tib" /partition:1-1
    When the batch file is run, the environment variable is expanded correctly (%weeknumber% is set to 16):
    Code:
    D:\>"c:\program files\acronis\trueimageechoworkstation\trueimagecmd" /create /filename:"[B][COLOR="Red"]d:\16\myenv.tib[/COLOR][/B]" /partition:1-1
    
    Locking partitions: completed
    
    
    Creating partition image
    [#########################.........................]  51%
    ---

    Another option may be to just rename the folder on the server every week (could be processed automatically by a script) instead of moving files.

    For example:

    Setup the backup task to always backup to the x:\0\ folder. Have your script check if the week has changed before the backup runs. If it has and the folder hasn't already been renamed, rename the "0" folder to the current week number and recreate the "0" folder so the backup task will find it.

    ---

    I don't know what OS you're running, but in Windows (in general), you can "move" a file (or folder) (a cut/paste type operation) and it doesn't actually copy or physically move the file -- it just changes the location reference of the file. This isn't the same as doing a copy and then deleting the original. I wouldn't think a "move" would generate much network traffic.
     
    Last edited: Apr 21, 2009
  14. Matlox

    Matlox Registered Member

    Joined:
    Apr 16, 2009
    Posts:
    8
    Location:
    France
    Thanks for the answer.

    I'll try both of your solution to see wich one is the best for me.

    When i say

    That's because at the moment, i backup my serveur on his own RAID5, and i want to move the backups to un network storage.

    With my final script, it will be saved directly on the NAS.


    Thanks MudCrab ;)
     
Thread Status:
Not open for further replies.