Copy the dir to another dir starting of each
Closed
ashu
-
Sep 10, 2009 at 02:46 AM
sharpman Posts 1021 Registration date Saturday May 23, 2009 Status Contributor Last seen October 20, 2010 - Oct 1, 2009 at 04:55 PM
sharpman Posts 1021 Registration date Saturday May 23, 2009 Status Contributor Last seen October 20, 2010 - Oct 1, 2009 at 04:55 PM
Related:
- Copy the dir to another dir starting of each
- How to start a listening party on spotify pc - Guide
- Dos dir command - Guide
- How to start steam in big picture mode - Guide
- How to start a new line in wechat - Guide
- Insert a new sheet at the end of the tab names and paste the range names starting in cell a1. autofit columns a:b and name the worksheet as range names. ✓ - Excel Forum
5 responses
sharpman
Posts
1021
Registration date
Saturday May 23, 2009
Status
Contributor
Last seen
October 20, 2010
183
Sep 13, 2009 at 08:00 AM
Sep 13, 2009 at 08:00 AM
using xcopy in your batch file you will be able to do this
https://www.petefreitag.com/item/99.cfm
for example
xcopy /S d:\text\*.* d:\text2\
this will copy the contents and all directories from d:\text and make a directory of text2 on d: and copy all the contents including directories from 'text' directory
using the switches in the first link you will be able to modify to suit your circumstances.
https://www.petefreitag.com/item/99.cfm
for example
xcopy /S d:\text\*.* d:\text2\
this will copy the contents and all directories from d:\text and make a directory of text2 on d: and copy all the contents including directories from 'text' directory
using the switches in the first link you will be able to modify to suit your circumstances.
sharpman
Posts
1021
Registration date
Saturday May 23, 2009
Status
Contributor
Last seen
October 20, 2010
183
Sep 13, 2009 at 12:41 PM
Sep 13, 2009 at 12:41 PM
ok try this
xcopy /E /I e:\ashu\share\file and documents\*.* e:\ashu\share\backup file and documents\20090901
that works for me.
what you did was /S and /E but implies that the /S switch is used so you only need /E
if you use the line as amended it will do what you require.
hope that helps.
let me know. thanks
xcopy /E /I e:\ashu\share\file and documents\*.* e:\ashu\share\backup file and documents\20090901
that works for me.
what you did was /S and /E but implies that the /S switch is used so you only need /E
if you use the line as amended it will do what you require.
hope that helps.
let me know. thanks
Hi Sharpman,
It resolved my issue but not completely that I was looking. I also looking for creation of new destination folder month wise as I will schedule this script to run monthly (e.g. If batch file runs on 1st day of October all source directory conetnt copied to new destination folder like 20091001 then for Nov 20091101, for Dec 20091201, for Jan 20100101 like goes on)
could you please suggest or help in this regard.
Thanks in advance
It resolved my issue but not completely that I was looking. I also looking for creation of new destination folder month wise as I will schedule this script to run monthly (e.g. If batch file runs on 1st day of October all source directory conetnt copied to new destination folder like 20091001 then for Nov 20091101, for Dec 20091201, for Jan 20100101 like goes on)
could you please suggest or help in this regard.
Thanks in advance
sharpman
Posts
1021
Registration date
Saturday May 23, 2009
Status
Contributor
Last seen
October 20, 2010
183
>
ashu
Sep 15, 2009 at 06:18 PM
Sep 15, 2009 at 06:18 PM
Ok Ashu,
Give this a go.
-----------------------------------------------------------------------------------------
@ECHO OFF
rem works in XP
rem =====================
rem setting the variables for use
rem =====================
SET dd=%DATE:~0,2%
SET mm=%DATE:~3,2%
SET yyyy=%DATE:~6,4%
rem ============================
rem following line will copy directory and all
rem sub directory contents into dated directory
rem ============================
xcopy /E /I d:\working_directory\*.* d:\backup_directory\%yyyy%%mm%%dd%
----------------------------------------------------------------------------------------------
again, edit to suit.
let me know if that works for your purpose.
Give this a go.
-----------------------------------------------------------------------------------------
@ECHO OFF
rem works in XP
rem =====================
rem setting the variables for use
rem =====================
SET dd=%DATE:~0,2%
SET mm=%DATE:~3,2%
SET yyyy=%DATE:~6,4%
rem ============================
rem following line will copy directory and all
rem sub directory contents into dated directory
rem ============================
xcopy /E /I d:\working_directory\*.* d:\backup_directory\%yyyy%%mm%%dd%
----------------------------------------------------------------------------------------------
again, edit to suit.
let me know if that works for your purpose.
Hi Sharpman,
I tried this but this does not work. could you please let me know in any other way if we can acheive it.
thanks,
Ashish
I tried this but this does not work. could you please let me know in any other way if we can acheive it.
thanks,
Ashish
sharpman
Posts
1021
Registration date
Saturday May 23, 2009
Status
Contributor
Last seen
October 20, 2010
183
Sep 17, 2009 at 05:00 PM
Sep 17, 2009 at 05:00 PM
when you say it does not work, what errors, if any are you getting.
I have tried it on my system using test directories and it worked a treat. where or what is it not working on?
I have tried it on my system using test directories and it worked a treat. where or what is it not working on?
I have copied the command as it and changed the source and destination folder path, when I executed it, It didnt run. Please correct me if I am doing wrong thing
here is my command
@ECHO OFF
rem works in XP
rem =====================
rem setting the variables for use
rem =====================
SET dd=%DATE:~0,2%
SET mm=%DATE:~3,2%
SET yyyy=%DATE:~6,4%
rem ============================
rem following line will copy directory and all
rem sub directory contents into dated directory
rem ============================
xcopy /E /I "e:\ashu\share\file and documents\*.*" "e:\ashu\share\backup file and documents\%yyyy%%mm%%dd%"
Please correct me if I doing in right way.....Thanks you a lot for your patience and efforts till now
here is my command
@ECHO OFF
rem works in XP
rem =====================
rem setting the variables for use
rem =====================
SET dd=%DATE:~0,2%
SET mm=%DATE:~3,2%
SET yyyy=%DATE:~6,4%
rem ============================
rem following line will copy directory and all
rem sub directory contents into dated directory
rem ============================
xcopy /E /I "e:\ashu\share\file and documents\*.*" "e:\ashu\share\backup file and documents\%yyyy%%mm%%dd%"
Please correct me if I doing in right way.....Thanks you a lot for your patience and efforts till now
Didn't find the answer you are looking for?
Ask a question
sharpman
Posts
1021
Registration date
Saturday May 23, 2009
Status
Contributor
Last seen
October 20, 2010
183
Sep 18, 2009 at 03:00 PM
Sep 18, 2009 at 03:00 PM
what are the speech marks for? ("")
maybe that is causing an issue.
also, if you name your directories thus:
file_and_documents
backup_file_and_documents
don't think it likes the spaces in directory names
maybe that is causing an issue.
also, if you name your directories thus:
file_and_documents
backup_file_and_documents
don't think it likes the spaces in directory names
sharpman
Posts
1021
Registration date
Saturday May 23, 2009
Status
Contributor
Last seen
October 20, 2010
183
>
Ashu
Oct 1, 2009 at 04:55 PM
Oct 1, 2009 at 04:55 PM
thanks Ashu, glad to help, keeps me on me toes. :-)
Sep 13, 2009 at 08:30 AM
Thank you for your reply
I tried this switch already and tried once again after your reply but it does not work. When I ran batch file nothing copied in destination directory...
here is the batch file that I m using on windows server 2003
xcopy /S /E e:\ashu\share\file and documents\*.* e:\ashu\share\backup file and documents\20090901
could you please suggest how it can be achieved
Thanks in advance