Advertise on Bikeforums.net



User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 28
  1. #1
    Look! My Spine! RubenX's Avatar
    Join Date
    Apr 2008
    Location
    Winter Springs, FL
    Posts
    539
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    I need a very simple backup script for just one folder in Win7

    I run a local Minecraft server on one PC here. Me, my son, my daughter, everybody builds stuff on it. Occasionally somebody trips while carrying a lava bucket and the whole town burns like Rome.

    Had it been Linux (like it should be), a quikie shel/perl script scheduled in crontab will do. But my Win7 noobness comes into play here.

    This is what I need.

    * Copy the contents of <some folder> into a <backup folder parent> / <backup dd-mm-yyyy>
    * Check all the dd-mm-yyyy and delete whatever is older than 30 days.
    * A way to make it run daily, maybe twice a day.

    Something simple and native to Win7... I don't wanna get into installing perl for windows or stuff like that.

    Recommendations?
    "Hoy es un dia normal, pero yo voy a hacerlo intenso" ~ Juanes

  2. #2
    Senior Member mechBgon's Avatar
    Join Date
    Jul 2002
    Posts
    6,957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If your version is Windows Pro or Ultimate, use the built-in Backup utility to schedule the backup jobs. Another option is robocopy.exe; I don't have time to dredge up the precise command-line options you'll need right this minute, but can help with that later if you need a hand.

  3. #3
    AEO
    AEO is offline
    Senior Member AEO's Avatar
    Join Date
    Jun 2007
    Location
    A Coffin Called Earth. or Toronto, ON
    My Bikes
    Bianchi, Miyata, Dahon, Rossin
    Posts
    12,245
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    a fairly comprehensive scheduled backup software is also in win7 HP version.
    yeah, it goes down to daily and folder.

    I thought it was a bit more comprehensive, but that turned out to be lenovo preload software.
    Last edited by AEO; 11-20-11 at 08:26 PM.
    Food for thought: if you aren't dead by 2050, you and your entire family will be within a few years from starvation. Now that is a cruel gift to leave for your offspring. ;)
    http://sanfrancisco.ibtimes.com/arti...ger-photos.htm

  4. #4
    Look! My Spine! RubenX's Avatar
    Join Date
    Apr 2008
    Location
    Winter Springs, FL
    Posts
    539
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mechBgon View Post
    If your version is Windows Pro or Ultimate, use the built-in Backup utility to schedule the backup jobs. Another option is robocopy.exe; I don't have time to dredge up the precise command-line options you'll need right this minute, but can help with that later if you need a hand.
    I just tried the Win7's native backup. Didn't let chose a destination folder, only a drive... something I can bypass by mounting a folder as a drive. But I have a huntch that the robocopy will fit my needs better. Will try it... thx
    "Hoy es un dia normal, pero yo voy a hacerlo intenso" ~ Juanes

  5. #5
    Senior Member
    Join Date
    Oct 2005
    Posts
    14,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A batch with a xcopy command and pass the date to the folder being created as a variable.
    Combine that with a forfiles command to delete the files older than x date. Run said batch in the job scheduler.

    Me...I would throw something together in Perl.

  6. #6
    Senior Member mechBgon's Avatar
    Join Date
    Jul 2002
    Posts
    6,957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or if you have a spare USB flash drive, you could devote that to your Minecraft backup jobs.

  7. #7
    Look! My Spine! RubenX's Avatar
    Join Date
    Apr 2008
    Location
    Winter Springs, FL
    Posts
    539
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mechBgon View Post
    Or if you have a spare USB flash drive, you could devote that to your Minecraft backup jobs.
    Bingo! I do have 8gb flash that I'm not using because the plastic case broke... the whole folder is just 25mb so, that's it.

    and it will even work for total catastrofic pc failure.
    "Hoy es un dia normal, pero yo voy a hacerlo intenso" ~ Juanes

  8. #8
    derailleurs are overrated bigbenaugust's Avatar
    Join Date
    Feb 2005
    Location
    KIGX
    My Bikes
    2009 Motobecane Fantom CX, 2012 Motobecane Fantom Cross Uno SSCX
    Posts
    1,737
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Is ActiveState Perl still freely available for Windows machines? It's been a LONG time since I put perl on a Windows box without Cygwin.

    Otherwise, robocopy or xcopy in batch would do it. Add to your Scheduled Tasks.
    --Ben
    Carrboro Bike Coalition - putting the "bike" in "CARrboro" :)
    2011 Motobecane Fantom Cross Uno, 2009 Motobecane Fantom CX
    Previously: 2000 Trek 4500 (2000-2003), 2003 Novara Randonee (2003-2006), 2003 Giant Rainier (2003-2008), 2005 Xootr Swift (2005-2007), 2007 Nashbar 1x9 (2007-2011), 2011 Windsor Shetland (2011-2014)
    Current Linux Usage (by machine): Arch: I openSUSE: III

  9. #9
    Senior Member
    Join Date
    Oct 2005
    Posts
    14,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is still available. I use it on my windows box. I believe strawberry perl is available as well.

  10. #10
    Banned. ModoVincere's Avatar
    Join Date
    Aug 2006
    Posts
    1,628
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DataJunkie View Post
    A batch with a xcopy command and pass the date to the folder being created as a variable.
    Combine that with a forfiles command to delete the files older than x date. Run said batch in the job scheduler.

    Me...I would throw something together in Perl.
    .bat file with copy or xcopy the specified folder.....and a job scheduler. Then sit back and let the fun begin.

  11. #11
    Chepooka StupidlyBrave's Avatar
    Join Date
    Sep 2006
    Location
    South Central PA
    My Bikes
    1990 Trek 1400 7spd; 2001 Litespeed Arenberg 10 speed
    Posts
    1,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For linux, I would use rsync & cron
    For pc, I would use cygwin rsync & scheduled tasks

  12. #12
    Fat Guy Rolling dcrowell's Avatar
    Join Date
    Jul 2008
    Location
    Louisville Kentucky
    My Bikes
    Bacchetta Agio, 80s Raleigh Record single-speed, Surly Big Dummy
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Robocopy, as mentioned above. Schedule it and forget it.
    Car-Free IT Geek
    My blog: fatguy.org

    Bikes: Surly Big Dummy, 1980s Raleigh Record single-speed conversion, Bacchetta Agio

  13. #13
    You Know!? For Kids! jsharr's Avatar
    Join Date
    Apr 2005
    Location
    Just NW of Richardson Bike Mart
    My Bikes
    '05 Trek 1200 / '90 Trek 8000 / '? Falcon Europa
    Posts
    6,084
    Mentioned
    12 Post(s)
    Tagged
    3 Thread(s)
    I would do it by hand. just look at the code and write it down on a legal pad a few times a day.
    Are you a registered member? Why not? Click here to register. It's free and only takes 27 seconds! Help out the forums, abide by our community guidelines.
    Quote Originally Posted by colorider View Post
    Phobias are for irrational fears. Fear of junk ripping badgers is perfectly rational. Those things are nasty.

  14. #14
    Senior Member mikeybikes's Avatar
    Join Date
    May 2009
    Location
    Edgewater, CO
    My Bikes
    Tons
    Posts
    3,028
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jsharr View Post
    I would do it by hand. just look at the code and write it down on a legal pad a few times a day.
    Easier to just open it up in Notepad and print it.
    My Bikes: 2009 Breezer Uptown EX | 1980 Miyata 610 | 1970 Hercules | 198? Miele ?
    Wife's Bike: 2008 Globe City 7

  15. #15
    You Know!? For Kids! jsharr's Avatar
    Join Date
    Apr 2005
    Location
    Just NW of Richardson Bike Mart
    My Bikes
    '05 Trek 1200 / '90 Trek 8000 / '? Falcon Europa
    Posts
    6,084
    Mentioned
    12 Post(s)
    Tagged
    3 Thread(s)
    I was going simple. In my plan, he uses a #2 pencil, hand sharpened, not some fancy high tech machine sharpened pencil and definitely not a mechanical pencil.
    Are you a registered member? Why not? Click here to register. It's free and only takes 27 seconds! Help out the forums, abide by our community guidelines.
    Quote Originally Posted by colorider View Post
    Phobias are for irrational fears. Fear of junk ripping badgers is perfectly rational. Those things are nasty.

  16. #16
    Senior Member
    Join Date
    Sep 2007
    Posts
    835
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    google xcopy and del.

    what you need to do is two short lines of easy code that runs in any version of windows.

    you use del to delete old stuff and xcopy to copy new stuff

    save your two lines of code in a .bat file, and go into scheduled tasks (in your control panels) and set up your bat file to run every day at a specific time

    I use xcopy

  17. #17
    GATC
    Join Date
    Jul 2006
    Location
    south Puget Sound
    Posts
    6,609
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I like SyncToy esp. for saving daily backups separately. I don't know about going back after a month to delete the older ones but it seems like it should do that.

  18. #18
    Senior Member somedood's Avatar
    Join Date
    Dec 2006
    Location
    UT
    My Bikes
    Ibex Xray
    Posts
    397
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    robocopy? perl? Come on people, this is an easy one.

    Save this as a batch file, something like 'savefolderdate.bat'

    @echo off
    for /f "tokens=2* delims= " %%a in ('date /t') do set mmddyyyy=%%a
    for /f "tokens=1* delims=/" %%a in ('echo %mmddyyyy%') do set day=%%a
    for /f "tokens=2* delims=/" %%a in ('echo %mmddyyyy%') do set month=%%a
    for /f "tokens=3* delims=/" %%a in ('echo %mmddyyyy%') do set year=%%a

    for /f "tokens=1* delims=:" %%a in ('time /t') do set hour=%%a
    for /f "tokens=2* delims=:" %%a in ('time /t') do set secondhalf=%%a
    for /f "tokens=1* delims= " %%a in ('echo %secondhalf%') do set minute=%%a

    set destfolder=%2\%year%-%month%-%day%_%hour%%minute%

    IF NOT EXIST %destfolder% mkdir %destfolder%

    @echo on
    echo copying folder '%1' to '%destfolder%'

    xcopy %1 %destfolder% /E /Y
    Setup a scheduled task to run this, and give it 2 folders are the source and destination as arguments to the batch file:

    savefolderdate.bat c:\full\path\to\folder c:\full\path\to\destinationfolder

    This will save everything (including subfolders) in the source folder and put it in a subfolder in the destination named as YYYY-MM-DD_HHMM so it will be a unique folder as long as it isn't run during the same minute. Really the only difficulty is that there aren't any environment variables for the individual parts of the date and time so that's all the first part is doing.

  19. #19
    Senior Member
    Join Date
    Oct 2005
    Posts
    14,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I said I would use Perl. I said nothing about him using perl. Egads

  20. #20
    Look! My Spine! RubenX's Avatar
    Join Date
    Apr 2008
    Location
    Winter Springs, FL
    Posts
    539
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DataJunkie View Post
    I said I would use Perl. I said nothing about him using perl. Egads
    Hey! I just happen to be the best perl coder in the whole state of Florida... in fact, I can right now tell you, your copy of the perl cookbook from oreilly's is almost broken on page 33, where the list of regular expressions lies.
    "Hoy es un dia normal, pero yo voy a hacerlo intenso" ~ Juanes

  21. #21
    Senior Member mikeybikes's Avatar
    Join Date
    May 2009
    Location
    Edgewater, CO
    My Bikes
    Tons
    Posts
    3,028
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Select all the files you want to backup.
    Hold down the shift key while pressing the delete key on your keyboard.
    When asked if you are sure, click Yes.

    All of your files are now backed up.
    My Bikes: 2009 Breezer Uptown EX | 1980 Miyata 610 | 1970 Hercules | 198? Miele ?
    Wife's Bike: 2008 Globe City 7

  22. #22
    Senior Member somedood's Avatar
    Join Date
    Dec 2006
    Location
    UT
    My Bikes
    Ibex Xray
    Posts
    397
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DataJunkie View Post
    I said I would use Perl. I said nothing about him using perl. Egads
    I was just trying to poke fun at a fellow nerd, but for the file deletion part I don't see a way around using something outside of what comes with windows. I guess he could use visual basic, but I'm not taking the time to figure that out because of laziness.

    Here's a solution that will do mostly what you want. This will keep up to X number of folders, deleting the extras starting with the oldest first. So if you are ok with keeping the most recent X number of backups (rather than backups newer than 30 days old), then this should work fine. name this something like 'deleteoldbackups.bat'

    @ECHO OFF
    FOR /F "skip=%2" %%f IN ('dir %1\*-*-*_* /O:-D /T:C /A /B') DO rmdir /s /q %1\%%f
    You'd run this like (same thing, just add to scheduled tasks):

    deleteoldbackups.bat c:\full\path\to\destinationfolder 40

    If would look in the folder "c:\full\path\to\destinationfolder" for folders that match the date pattern used for backing up, and if there are more than 40 it will delete any after 40 starting with the oldest first. It determines age by the folder creation time, not the file/folder name.

  23. #23
    Senior Member
    Join Date
    Oct 2005
    Posts
    14,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry. I am fighting with a piece of code that is besting me. Ergo I am cranky.

  24. #24
    Senior Member
    Join Date
    Oct 2005
    Posts
    14,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by RubenX View Post
    Hey! I just happen to be the best perl coder in the whole state of Florida... in fact, I can right now tell you, your copy of the perl cookbook from oreilly's is almost broken on page 33, where the list of regular expressions lies.
    Regular expressions = days of fun.

  25. #25
    Senior Member somedood's Avatar
    Join Date
    Dec 2006
    Location
    UT
    My Bikes
    Ibex Xray
    Posts
    397
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DataJunkie View Post
    Sorry. I am fighting with a piece of code that is besting me. Ergo I am cranky.
    Oh man, I feel your pain. There are some days when, after hours of stupid debugging I finally figure it out, and it's like a rush or intense feeling of satisfaction. Most of the time though I have to hang my head in shame because I did something stupid.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •