batch file to copy files to another location?
up vote
7
down vote
favorite
is it possible to create a batch file to copy a folder to another location everytime I login, or when the folder is updated?
It could be written in vb or java aswel if not an easy solution.
Any ideas? Thanks
batch-file
add a comment |
up vote
7
down vote
favorite
is it possible to create a batch file to copy a folder to another location everytime I login, or when the folder is updated?
It could be written in vb or java aswel if not an easy solution.
Any ideas? Thanks
batch-file
add a comment |
up vote
7
down vote
favorite
up vote
7
down vote
favorite
is it possible to create a batch file to copy a folder to another location everytime I login, or when the folder is updated?
It could be written in vb or java aswel if not an easy solution.
Any ideas? Thanks
batch-file
is it possible to create a batch file to copy a folder to another location everytime I login, or when the folder is updated?
It could be written in vb or java aswel if not an easy solution.
Any ideas? Thanks
batch-file
batch-file
asked Feb 3 '10 at 20:33
Elliott
1,460206088
1,460206088
add a comment |
add a comment |
8 Answers
8
active
oldest
votes
up vote
8
down vote
accepted
Two approaches:
When you login: you can to create a
copy_my_files.bat
file into yourAll Programs > Startup
folder with this content (its a plain text document):
xcopy c:folder*.* d:another_folder.
Use
xcopy c:folder*.* d:another_folder. /Y
to overwrite the file without any prompt.
Everytime a folder changes: if you can to use C#, you can to create a program using
FileSystemWatcher
add a comment |
up vote
3
down vote
@echo off
copy con d:*.*
xcopy d:*.* e:*.*
pause
puase = pause .
– K_B
Apr 29 '13 at 9:38
This doesn't work.
– Endoro
Apr 29 '13 at 9:45
add a comment |
up vote
1
down vote
Open Notepad.
Type the following lines into it (obviously replace the folders with your ones)
@echo off
rem you could also remove the line above, because it might help you to see what happens
rem /i option is needed to avoid the batch file asking you whether destination folder is a file or a folder
rem /e option is needed to copy also all folders and subfolders
xcopy "c:New Folder" "c:Copy of New Folder" /i /e
Save the file as backup.bat (not .txt)
Double click on the file to run it. It will backup the folder and all its contents files/subfolders.
Now if you want the batch file to be run everytime you login in Windows, you should place it in Windows Startup menu. You find it under: Start > All Program > Startup
To place the batch file in there either drag it into the Startup menu or RIGH click on the Windows START button and select Explore, go in Programs > Startup, and copy the batch file into there.
To run the batch file everytime the folder is updated you need an application, it can not be done with just a batch file.
add a comment |
up vote
0
down vote
Batch file to copy folder is easy.
xcopy /Y C:Source*.* C:NewFolder
Save the above as a batch file, and get Windows to run it on start up.
To do the same thing when folder is updated is trickier, you'll need a program that monitors the folder every x time and check for changes. You can write the program in VB/Java/whatever then schedule it to run every 30mins.
add a comment |
up vote
0
down vote
It's easy to copy a folder in a batch file.
@echo off
set src_folder = c:whatever*.*
set dst_folder = c:foo
xcopy /S/E/U %src_folder% %dst_folder%
And you can add that batch file to your Windows login script pretty easily (assuming you have admin rights on the machine). Just go to the "User Manager" control panel, choose properties for your user, choose profile and set a logon script.
How you get to the user manager control panel depends on which version of Windows you run. But right clicking on My Computer and choosing manage and then choosing Local users and groups works for most versions.
The only sticky bit is "when the folder is updated". This sounds like a folder watcher, which you can't do in a batch file, but you can do pretty easily with .NET.
add a comment |
up vote
0
down vote
robocopy yourfolder yourdestination /MON:0
should do it, although you may need some more options. The switch at the end will re-run robocopy if more than 0 changes are seen.
add a comment |
up vote
0
down vote
@echo off
cls
echo press any key to continue backup !
pause
xcopy c:usersfile*.* e:backup*.* /s /e
echo backup complete
pause
file = name of file your wanting to copy
backup = where u want the file to be moved to
Hope this helps
add a comment |
up vote
-2
down vote
@echo off
xcopy ...
Replace ...
with the appropriate xcopy arguments to copy what you want copied.
add a comment |
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
8
down vote
accepted
Two approaches:
When you login: you can to create a
copy_my_files.bat
file into yourAll Programs > Startup
folder with this content (its a plain text document):
xcopy c:folder*.* d:another_folder.
Use
xcopy c:folder*.* d:another_folder. /Y
to overwrite the file without any prompt.
Everytime a folder changes: if you can to use C#, you can to create a program using
FileSystemWatcher
add a comment |
up vote
8
down vote
accepted
Two approaches:
When you login: you can to create a
copy_my_files.bat
file into yourAll Programs > Startup
folder with this content (its a plain text document):
xcopy c:folder*.* d:another_folder.
Use
xcopy c:folder*.* d:another_folder. /Y
to overwrite the file without any prompt.
Everytime a folder changes: if you can to use C#, you can to create a program using
FileSystemWatcher
add a comment |
up vote
8
down vote
accepted
up vote
8
down vote
accepted
Two approaches:
When you login: you can to create a
copy_my_files.bat
file into yourAll Programs > Startup
folder with this content (its a plain text document):
xcopy c:folder*.* d:another_folder.
Use
xcopy c:folder*.* d:another_folder. /Y
to overwrite the file without any prompt.
Everytime a folder changes: if you can to use C#, you can to create a program using
FileSystemWatcher
Two approaches:
When you login: you can to create a
copy_my_files.bat
file into yourAll Programs > Startup
folder with this content (its a plain text document):
xcopy c:folder*.* d:another_folder.
Use
xcopy c:folder*.* d:another_folder. /Y
to overwrite the file without any prompt.
Everytime a folder changes: if you can to use C#, you can to create a program using
FileSystemWatcher
edited Oct 21 '16 at 12:17
Nilesh Vora
71111
71111
answered Feb 3 '10 at 20:38
Rubens Farias
48.5k3109148
48.5k3109148
add a comment |
add a comment |
up vote
3
down vote
@echo off
copy con d:*.*
xcopy d:*.* e:*.*
pause
puase = pause .
– K_B
Apr 29 '13 at 9:38
This doesn't work.
– Endoro
Apr 29 '13 at 9:45
add a comment |
up vote
3
down vote
@echo off
copy con d:*.*
xcopy d:*.* e:*.*
pause
puase = pause .
– K_B
Apr 29 '13 at 9:38
This doesn't work.
– Endoro
Apr 29 '13 at 9:45
add a comment |
up vote
3
down vote
up vote
3
down vote
@echo off
copy con d:*.*
xcopy d:*.* e:*.*
pause
@echo off
copy con d:*.*
xcopy d:*.* e:*.*
pause
edited Mar 12 '15 at 10:19
Appulus
11.8k93040
11.8k93040
answered Apr 29 '13 at 9:19
Mohammed Salem
311
311
puase = pause .
– K_B
Apr 29 '13 at 9:38
This doesn't work.
– Endoro
Apr 29 '13 at 9:45
add a comment |
puase = pause .
– K_B
Apr 29 '13 at 9:38
This doesn't work.
– Endoro
Apr 29 '13 at 9:45
puase = pause .
– K_B
Apr 29 '13 at 9:38
puase = pause .
– K_B
Apr 29 '13 at 9:38
This doesn't work.
– Endoro
Apr 29 '13 at 9:45
This doesn't work.
– Endoro
Apr 29 '13 at 9:45
add a comment |
up vote
1
down vote
Open Notepad.
Type the following lines into it (obviously replace the folders with your ones)
@echo off
rem you could also remove the line above, because it might help you to see what happens
rem /i option is needed to avoid the batch file asking you whether destination folder is a file or a folder
rem /e option is needed to copy also all folders and subfolders
xcopy "c:New Folder" "c:Copy of New Folder" /i /e
Save the file as backup.bat (not .txt)
Double click on the file to run it. It will backup the folder and all its contents files/subfolders.
Now if you want the batch file to be run everytime you login in Windows, you should place it in Windows Startup menu. You find it under: Start > All Program > Startup
To place the batch file in there either drag it into the Startup menu or RIGH click on the Windows START button and select Explore, go in Programs > Startup, and copy the batch file into there.
To run the batch file everytime the folder is updated you need an application, it can not be done with just a batch file.
add a comment |
up vote
1
down vote
Open Notepad.
Type the following lines into it (obviously replace the folders with your ones)
@echo off
rem you could also remove the line above, because it might help you to see what happens
rem /i option is needed to avoid the batch file asking you whether destination folder is a file or a folder
rem /e option is needed to copy also all folders and subfolders
xcopy "c:New Folder" "c:Copy of New Folder" /i /e
Save the file as backup.bat (not .txt)
Double click on the file to run it. It will backup the folder and all its contents files/subfolders.
Now if you want the batch file to be run everytime you login in Windows, you should place it in Windows Startup menu. You find it under: Start > All Program > Startup
To place the batch file in there either drag it into the Startup menu or RIGH click on the Windows START button and select Explore, go in Programs > Startup, and copy the batch file into there.
To run the batch file everytime the folder is updated you need an application, it can not be done with just a batch file.
add a comment |
up vote
1
down vote
up vote
1
down vote
Open Notepad.
Type the following lines into it (obviously replace the folders with your ones)
@echo off
rem you could also remove the line above, because it might help you to see what happens
rem /i option is needed to avoid the batch file asking you whether destination folder is a file or a folder
rem /e option is needed to copy also all folders and subfolders
xcopy "c:New Folder" "c:Copy of New Folder" /i /e
Save the file as backup.bat (not .txt)
Double click on the file to run it. It will backup the folder and all its contents files/subfolders.
Now if you want the batch file to be run everytime you login in Windows, you should place it in Windows Startup menu. You find it under: Start > All Program > Startup
To place the batch file in there either drag it into the Startup menu or RIGH click on the Windows START button and select Explore, go in Programs > Startup, and copy the batch file into there.
To run the batch file everytime the folder is updated you need an application, it can not be done with just a batch file.
Open Notepad.
Type the following lines into it (obviously replace the folders with your ones)
@echo off
rem you could also remove the line above, because it might help you to see what happens
rem /i option is needed to avoid the batch file asking you whether destination folder is a file or a folder
rem /e option is needed to copy also all folders and subfolders
xcopy "c:New Folder" "c:Copy of New Folder" /i /e
Save the file as backup.bat (not .txt)
Double click on the file to run it. It will backup the folder and all its contents files/subfolders.
Now if you want the batch file to be run everytime you login in Windows, you should place it in Windows Startup menu. You find it under: Start > All Program > Startup
To place the batch file in there either drag it into the Startup menu or RIGH click on the Windows START button and select Explore, go in Programs > Startup, and copy the batch file into there.
To run the batch file everytime the folder is updated you need an application, it can not be done with just a batch file.
answered Feb 3 '10 at 21:05
Marco Demaio
19.4k30109142
19.4k30109142
add a comment |
add a comment |
up vote
0
down vote
Batch file to copy folder is easy.
xcopy /Y C:Source*.* C:NewFolder
Save the above as a batch file, and get Windows to run it on start up.
To do the same thing when folder is updated is trickier, you'll need a program that monitors the folder every x time and check for changes. You can write the program in VB/Java/whatever then schedule it to run every 30mins.
add a comment |
up vote
0
down vote
Batch file to copy folder is easy.
xcopy /Y C:Source*.* C:NewFolder
Save the above as a batch file, and get Windows to run it on start up.
To do the same thing when folder is updated is trickier, you'll need a program that monitors the folder every x time and check for changes. You can write the program in VB/Java/whatever then schedule it to run every 30mins.
add a comment |
up vote
0
down vote
up vote
0
down vote
Batch file to copy folder is easy.
xcopy /Y C:Source*.* C:NewFolder
Save the above as a batch file, and get Windows to run it on start up.
To do the same thing when folder is updated is trickier, you'll need a program that monitors the folder every x time and check for changes. You can write the program in VB/Java/whatever then schedule it to run every 30mins.
Batch file to copy folder is easy.
xcopy /Y C:Source*.* C:NewFolder
Save the above as a batch file, and get Windows to run it on start up.
To do the same thing when folder is updated is trickier, you'll need a program that monitors the folder every x time and check for changes. You can write the program in VB/Java/whatever then schedule it to run every 30mins.
answered Feb 3 '10 at 20:41
Robo
2,31762846
2,31762846
add a comment |
add a comment |
up vote
0
down vote
It's easy to copy a folder in a batch file.
@echo off
set src_folder = c:whatever*.*
set dst_folder = c:foo
xcopy /S/E/U %src_folder% %dst_folder%
And you can add that batch file to your Windows login script pretty easily (assuming you have admin rights on the machine). Just go to the "User Manager" control panel, choose properties for your user, choose profile and set a logon script.
How you get to the user manager control panel depends on which version of Windows you run. But right clicking on My Computer and choosing manage and then choosing Local users and groups works for most versions.
The only sticky bit is "when the folder is updated". This sounds like a folder watcher, which you can't do in a batch file, but you can do pretty easily with .NET.
add a comment |
up vote
0
down vote
It's easy to copy a folder in a batch file.
@echo off
set src_folder = c:whatever*.*
set dst_folder = c:foo
xcopy /S/E/U %src_folder% %dst_folder%
And you can add that batch file to your Windows login script pretty easily (assuming you have admin rights on the machine). Just go to the "User Manager" control panel, choose properties for your user, choose profile and set a logon script.
How you get to the user manager control panel depends on which version of Windows you run. But right clicking on My Computer and choosing manage and then choosing Local users and groups works for most versions.
The only sticky bit is "when the folder is updated". This sounds like a folder watcher, which you can't do in a batch file, but you can do pretty easily with .NET.
add a comment |
up vote
0
down vote
up vote
0
down vote
It's easy to copy a folder in a batch file.
@echo off
set src_folder = c:whatever*.*
set dst_folder = c:foo
xcopy /S/E/U %src_folder% %dst_folder%
And you can add that batch file to your Windows login script pretty easily (assuming you have admin rights on the machine). Just go to the "User Manager" control panel, choose properties for your user, choose profile and set a logon script.
How you get to the user manager control panel depends on which version of Windows you run. But right clicking on My Computer and choosing manage and then choosing Local users and groups works for most versions.
The only sticky bit is "when the folder is updated". This sounds like a folder watcher, which you can't do in a batch file, but you can do pretty easily with .NET.
It's easy to copy a folder in a batch file.
@echo off
set src_folder = c:whatever*.*
set dst_folder = c:foo
xcopy /S/E/U %src_folder% %dst_folder%
And you can add that batch file to your Windows login script pretty easily (assuming you have admin rights on the machine). Just go to the "User Manager" control panel, choose properties for your user, choose profile and set a logon script.
How you get to the user manager control panel depends on which version of Windows you run. But right clicking on My Computer and choosing manage and then choosing Local users and groups works for most versions.
The only sticky bit is "when the folder is updated". This sounds like a folder watcher, which you can't do in a batch file, but you can do pretty easily with .NET.
answered Feb 3 '10 at 20:46
John Knoeller
27.9k34384
27.9k34384
add a comment |
add a comment |
up vote
0
down vote
robocopy yourfolder yourdestination /MON:0
should do it, although you may need some more options. The switch at the end will re-run robocopy if more than 0 changes are seen.
add a comment |
up vote
0
down vote
robocopy yourfolder yourdestination /MON:0
should do it, although you may need some more options. The switch at the end will re-run robocopy if more than 0 changes are seen.
add a comment |
up vote
0
down vote
up vote
0
down vote
robocopy yourfolder yourdestination /MON:0
should do it, although you may need some more options. The switch at the end will re-run robocopy if more than 0 changes are seen.
robocopy yourfolder yourdestination /MON:0
should do it, although you may need some more options. The switch at the end will re-run robocopy if more than 0 changes are seen.
answered Nov 16 '10 at 12:29
Joey
261k62557597
261k62557597
add a comment |
add a comment |
up vote
0
down vote
@echo off
cls
echo press any key to continue backup !
pause
xcopy c:usersfile*.* e:backup*.* /s /e
echo backup complete
pause
file = name of file your wanting to copy
backup = where u want the file to be moved to
Hope this helps
add a comment |
up vote
0
down vote
@echo off
cls
echo press any key to continue backup !
pause
xcopy c:usersfile*.* e:backup*.* /s /e
echo backup complete
pause
file = name of file your wanting to copy
backup = where u want the file to be moved to
Hope this helps
add a comment |
up vote
0
down vote
up vote
0
down vote
@echo off
cls
echo press any key to continue backup !
pause
xcopy c:usersfile*.* e:backup*.* /s /e
echo backup complete
pause
file = name of file your wanting to copy
backup = where u want the file to be moved to
Hope this helps
@echo off
cls
echo press any key to continue backup !
pause
xcopy c:usersfile*.* e:backup*.* /s /e
echo backup complete
pause
file = name of file your wanting to copy
backup = where u want the file to be moved to
Hope this helps
answered Sep 1 '15 at 9:38
ANONYMOUS
1
1
add a comment |
add a comment |
up vote
-2
down vote
@echo off
xcopy ...
Replace ...
with the appropriate xcopy arguments to copy what you want copied.
add a comment |
up vote
-2
down vote
@echo off
xcopy ...
Replace ...
with the appropriate xcopy arguments to copy what you want copied.
add a comment |
up vote
-2
down vote
up vote
-2
down vote
@echo off
xcopy ...
Replace ...
with the appropriate xcopy arguments to copy what you want copied.
@echo off
xcopy ...
Replace ...
with the appropriate xcopy arguments to copy what you want copied.
answered Feb 3 '10 at 20:37
Anon.
43k66883
43k66883
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f2195223%2fbatch-file-to-copy-files-to-another-location%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown