astronomer Posted October 31, 2007 Share Posted October 31, 2007 Hello everyone, it's been a while since I last posted, but I was hoping someone could point me in the right direction to a solution to my query. I'm sure it's been asked before but a search of the forums hasn't revealed an answer yet. I want to backup a folder, stored on my C: drive (every night) to an external drive (F:), but I don't want the previous, backed up, folder overwritten, because it has the same name as the old backed up folder (if you see what I mean). To that end I hoped that the folder, could be named with the present date and/or time, then backed up to the F: drive. I'm using the "DirCopy" function to copy the folder. Many thanks in advance for any suggestions. Link to comment Share on other sites More sharing options...
Kerros Posted October 31, 2007 Share Posted October 31, 2007 (edited) CODE#include<Date.au3> $backup_path = "f:\" DirCreate($backup_path&@YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & "-" & @MIN & "-" & @SEC) Or CODE #include<Date.au3> $source = 'source' $dest = "f:\&@YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & "-" & @MIN & "-" & @SEC dircopy($source,$dest,0) Edited October 31, 2007 by Kerros Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance. Link to comment Share on other sites More sharing options...
Monamo Posted October 31, 2007 Share Posted October 31, 2007 Hello everyone, it's been a while since I last posted, but I was hoping someone could point me in the right direction to a solution to my query. I'm sure it's been asked before but a search of the forums hasn't revealed an answer yet. I want to backup a folder, stored on my C: drive (every night) to an external drive (F:), but I don't want the previous, backed up, folder overwritten, because it has the same name as the old backed up folder (if you see what I mean). To that end I hoped that the folder, could be named with the present date and/or time, then backed up to the F: drive. I'm using the "DirCopy" function to copy the folder. Many thanks in advance for any suggestions.#include <Date.au3> $rootdir = "C:\backups\" $backupfolder = StringReplace(_NowTime(4),":","") &"_" &@MDAY &"-" &@MON &"-" &@YEAR If Not FileExists($rootdir) Then DirCreate($rootdir) If Not @error Then DirCreate($rootdir & $backupfolder) - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
GEOSoft Posted October 31, 2007 Share Posted October 31, 2007 Hello everyone, it's been a while since I last posted, but I was hoping someone could point me in the right direction to a solution to my query. I'm sure it's been asked before but a search of the forums hasn't revealed an answer yet. I want to backup a folder, stored on my C: drive (every night) to an external drive (F:), but I don't want the previous, backed up, folder overwritten, because it has the same name as the old backed up folder (if you see what I mean). To that end I hoped that the folder, could be named with the present date and/or time, then backed up to the F: drive. I'm using the "DirCopy" function to copy the folder. Many thanks in advance for any suggestions.$Dir = "C:\Dir" $Dir2 = C:\Dir2" DirCopy($Dir, $Dir2) DirMove($Dir2, $Dir2 & "_" & FileGetTime($Dir2, 0, 1)) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
astronomer Posted November 1, 2007 Author Share Posted November 1, 2007 Thanks for the replies guys. Sorry I couldn't get back sooner, I had a few connection problems. Many thanks GEOSoft, that worked effortlessly for me, I really appreciate you all taking the time to help me. Link to comment Share on other sites More sharing options...
GEOSoft Posted November 1, 2007 Share Posted November 1, 2007 Thanks for the replies guys. Sorry I couldn't get back sooner, I had a few connection problems. Many thanks GEOSoft, that worked effortlessly for me, I really appreciate you all taking the time to help me. Glad it worked but depending on what you are doing you may want to use the comand line version of 7Zip to compress the folders to zip. It's much easier for incremental backups and you can just compare FileGetTime to decide whether or not to backup a file/folder. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
astronomer Posted November 1, 2007 Author Share Posted November 1, 2007 Glad it worked but depending on what you are doing you may want to use the comand line version of 7Zip to compress the folders to zip. It's much easier for incremental backups and you can just compare FileGetTime to decide whether or not to backup a file/folder.Thanks again GEOSoft. I see what you're getting at alright, but this little script is for a guy who runs a small business but knows nothing about computers, let alone zip files and incremental backups. The folder, that needs to be backed up at the close of business each day, will change each day (sales, stock, customer accounts, etc.). He doesn't know how to back up to another drive and I wont be there to keep him on the right track if he slips up, so I thought it better to use AutoIt to write the script to do it all for him, so all he has to do is run the exe to backup the folder and shutdown (Shutdown(9) ) the computer at the end of the day. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now