I have a hard disk drive that contains 3 folders some of these folders contain other folders.
i want to use a bat file with 7.Zip to zip them up and store them to another drive using the current date and time as the Zip file name.
I want the zip file to retain the directory structure in case i need to recover drive at a latter date
Drive I: is where the files and folders are now. (all files and folders to be copied)
Drive E: is where i want the zip file to end up. ( Nothing else in E: .Just for these zip files)
my efforts
C:>"C:\Program Files\7-Zip\7z.exe"a" "E:\%date:~-10,2%.%date:~-7,2%.%date:~-4,4%.%time:~-11,2%.%time:~-8,2%" "I:\"
My result
The filename, directory name, or volume label syntax is incorrect.
Any help apreciated
In the command I see, you need to write
.exe" a "E:
instead of.exe"a" "E:
. Otherwise, cmd.exe tries to execute a file named7z.exe"a
. You should also double-check your DATE syntax, e.g. by executingecho E:\%date:~-10.2%.whatever
.