Solved How to make a batch file that will copy a folder?

July 10, 2014 at 12:33:54
Specs: Windows 7
How to make a batch file that will copy a folder (namely the UserData folder of Chrome) daily to another folder and rename it sequencially?

I can make a batch file to copy a folder to another folder, but I need help with the renaming part, which would use "if exist" then... and if possible to copy on a timed schedule with fallback in case of error, but that last part is not essential.

message edited by zvereva


See More: How to make a batch file that will copy a folder?

Report •


#1
July 11, 2014 at 02:54:37
✔ Best Answer
:: put your src dir wjere I have c:.
::
::
::
::====== script starts here ===============
::
:: sequence.bat 2014-07-11 16:40:03.01
@echo off & setLocal enableDELAYedeXpansioN

pushd d:\bak\chrome

:main
for /L %%a in (1 1 1000) do (
if not exist %%a (
md %%a
set CURRENT=%%a
goto :donehere
)
)
:donehere
copy c:. !CURRENT!
::====== script ends here =================

=====================
M2 Golden-Triangle


Report •

#2
July 11, 2014 at 08:45:39
Howdi Golden Triangle. Thanks for the suggestion which ended up like this:

"quote"
@echo off & setLocal enableDELAYedeXpansioN
pushd c:\users\...\temp\comodo profiles\userdata
:main
for /L %%a in (1 1 1000) do (
if not exist %%a (
md %%a
set CURRENT=%%a
goto :donehere
)
)
:donehere
copy c:\users\...\appdata\local\comodo\dragon\userdata\*.* /s
"unquote"

Where ever I put the file and run it, I get an empty numbered folder . The sequencial numbering is working, but it is not copying anything and not where I want it to.

message edited by zvereva


Report •

#3
July 11, 2014 at 09:17:14
First off, are you really trying to use these paths?
[with ... in them]

c:\users\...\temp\comodo profiles\userdata
c:\users\...\appdata\local\comodo\dragon\userdata\*.* /s

=====================
M2 Golden-Triangle


Report •

Related Solutions

#4
July 11, 2014 at 22:40:03
No of course not. The ... are my profile name. I have substituted them here for privacy.

Report •


Ask Question