DonationCoder.com Software > Post New Requests Here
IDEA: usb drive backup program
Shades:
I downloaded a portable version of 7-zip and unpacked it on my USB stick, then created the following (simple) BATCH script:
--- Code: ActionScript ---@ECHO offREM --- Purpose of script: automatically create small 7-zip archive from all files on USB stick. ----------------------------------REM -----------------------------------------------------------------------------------------------------------------------------REM --- 01. - Type which drive letter is assigned to USB stick. -----------------------------------------------------------------ECHO -ECHO step 1: Type drive letter assigned to USB stick, for example: CECHO ---------------------------------------------------------------------ECHO SET /P driveLetter=[USB drive letter]REM GOTO :EOFGOTO Step2REMREM -----------------------------------------------------------------------------------------------------------------------------REM --- 02. - Initializing the folders for getting and creating the archives (user definable). ----------------------------------:Step2ECHO -ECHO step 2: Initializing required parametersECHO ---------------------------------------------------------------------REM --- note: date notation depends on regional settings from the system the script is executed on (current = Dutch!). ---------- REM --- current = Dutch on WinXP US --------------------------------------------------------------------------------------------- SET year=%date:~9,4%SET month=%date:~6,2%SET day=%date:~3,2%REM --- current = US on WinXP US ------------------------------------------------------------------------------------------------ REM SET year=%date:~10,4%REM SET month=%date:~7,2%REM SET day=%date:~4,2%REM --- current = US on WinXP NL ------------------------------------------------------------------------------------------------REM SET year=%date:~6,4%REM SET month=%date:~3,2%REM SET day=%date:~0,2%REM --- the order from the work date should always be the same (according to my preference) -------------------------------------SET workDate=%year%-%month%-%day%SET usbFolder="%driveLetter%:\"SET archiveFolder=C:\ArchiveSET recentArchive=%archiveFolder%\USB_%workDate%ECHO USB drive: %usbFolder%ECHO Archive file and path: %recentArchive%REM GOTO :EOFGOTO Step3REMREM -----------------------------------------------------------------------------------------------------------------------------REM --- 03 - Create the archive in the archive folder (-mx=9 is most extreme setting). ------------------------------------------:Step3ECHO -ECHO step 3: Creating archive %recentArchive%ECHO ---------------------------------------------------------------------"%driveLetter%:\7-ZipPortable\App\7-zip\7z.exe" a -t7z %recentArchive%.7z %driveLetter%:\* -w%archiveFolder% -mx=9
or get the script from here [attachment]
It works on my XP and Win7 system, but please bear in mind that it was whipped up in 5 minutes, so there will be a lot of points for improvement.
techidave:
Thanks Shades for the script. I have d/l it and have edited the script to the best of my ability. But the script doesn't complete. see attached screenshot. I am placing the script here too. I think it is line 48(last line before the pause) that needs to be edited but I don't know what to.
@ECHO off
REM --- Purpose of script: automatically create small 7-zip archive from latest files on USB stick. -----------------------------
REM -----------------------------------------------------------------------------------------------------------------------------
REM --- 01. - Type which drive letter is assigned to USB stick. -----------------------------------------------------------------
ECHO -
ECHO step 1: Type drive letter assigned to USB stick, for example: C
ECHO ---------------------------------------------------------------------
ECHO
SET /P driveLetter=[USB drive letter]
REM GOTO :EOF
GOTO Step2
REM
REM -----------------------------------------------------------------------------------------------------------------------------
REM --- 02. - Initializing the folders for getting and creating the archives (user definable). ----------------------------------
:Step2
ECHO -
ECHO step 2: Initializing required parameters
ECHO ---------------------------------------------------------------------
REM --- note: date notation depends on regional settings from the system the script is executed on (current = Dutch!). ----------
REM --- current = Dutch on WinXP US ---------------------------------------------------------------------------------------------
SET year=%date:~9,4%
SET month=%date:~6,2%
SET day=%date:~3,2%
REM --- current = US on WinXP US ------------------------------------------------------------------------------------------------
REM SET year=%date:~10,4%
REM SET month=%date:~7,2%
REM SET day=%date:~4,2%
REM --- current = US on WinXP NL ------------------------------------------------------------------------------------------------
REM SET year=%date:~6,4%
REM SET month=%date:~3,2%
REM SET day=%date:~0,2%
REM --- the order from the work date should always be the same (according to my preference) -------------------------------------
SET workDate=%year%-%month%-%day%
SET usbFolder="%driveLetter%:\"
SET archiveFolder=C:\Kingston Backup 16gb
SET recentArchive=%archiveFolder%\USB_%workDate%
ECHO USB drive: %usbFolder%
ECHO Archive file and path: %recentArchive%
REM GOTO :EOF
GOTO Step3
REM
REM -----------------------------------------------------------------------------------------------------------------------------
REM --- 03 - Create the archive in the archive folder (-mx=9 is most extreme setting). ------------------------------------------
:Step3
ECHO -
ECHO step 3: Creating archive %recentArchive%
ECHO ---------------------------------------------------------------------
"%driveLetter%:\7-ZipPortable\App\7-zip\7z.exe" a -t7z %recentArchive%.7z %driveLetter%:\* -w%archiveFolder% -mx=9
pause
Deozaan:
It looks to me like something is wrong with the workDate. What should be "2010-03-21" is showing up as "201-/2- 0"
techidave:
I saw that too but don't know where to change it at.
Oh, maybe I need to REM out the Dutch settings and then unREM (?) the US settings???
techidave:
Ok, I got farther after changing the script but still get this error. I think that last line with the %recent and that kind of stuff needs edited now. But to what??
-
step 1: Type drive letter assigned to USB stick, for example: C
---------------------------------------------------------------------
ECHO is off.
[USB drive letter]e
-
step 2: Initializing required parameters
---------------------------------------------------------------------
USB drive: "e:\"
Archive file and path: C:\Kingston Backup 16gb\USB_2010-21-03
-
step 3: Creating archive C:\Kingston Backup 16gb\USB_2010-21-03
---------------------------------------------------------------------
7-Zip 4.65 Copyright (c) 1999-2009 Igor Pavlov 2009-02-03
Scanning
16gb: WARNING: The system cannot find the file specified.
16gb: WARNING: The system cannot find the file specified.
Creating archive C:\Kingston.7z
Error:
Duplicate filename:
backup
backup
Press any key to continue . . .
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version