0
votes

I am trying to figure out why this batch script is containing extra folders. This is part of a daily backup that runs on windows.

set cur_yyyy=%date:~10,4%
set cur_mm=%date:~4,2%
set cur_dd=%date:~7,2%
set ts=%cur_yyyy%-%cur_mm%-%cur_dd%

cd F:\_htdocs
"C:\Program Files\7-Zip\7z.exe" a -t7z "F:\_7z\%ts%_backup.7z" "F:\_htdocs" -r -mx=7

Basically when this script runs I need it to contain only the _htdocs folder and what is inside it. For some reason, 7zip will randomly include other folders.

I've noticed too when watching the script runs it seems to scan everything on the F drive and gives some errors like folder not accessible, etc. As if it's trying to include extra folders.

Omit the -r switch which recurses into subdirectories. Switches should be placed following the command. You should also change cd F:\_htdocs to cd /d F:\_htdocs or pushd F:\_htdocs - user6811411
Try with "F:\_htdocs\*" - MC ND
Removing the -r switch seemed to work, however I am still unsure why it would randomly select other folders. - drooh