Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > Windows Server

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-30-2008, 07:49 PM
JohnB
 
Posts: n/a
Another batch file question

How would I do this:

I have a server with a drive letter mapped to F:
I need to copy some of the folders from F: to an existing folder on drive
T:, which is on another server.
Say the folder names on F: are Folder1 and Folder2. (there's actually about
10 folders)
I want to copy Folder1 and Folder2 to drive T:
How can I copy Folder1 and all it's sub-contents to T: without first
creating a folder in the existing folder on T:
I want to avoid, if possible, doing a: MD t:\Folder1 and copying the
contents of F:\Folder1
In other words, I want the copy, or in this case, xcopy, command to create
the folder name for me.

Is there a way to do that?

TIA

Reply With Quote
  #2 (permalink)  
Old 06-30-2008, 08:48 PM
Pegasus \(MVP\)
 
Posts: n/a
Re: Another batch file question


"JohnB" <jbrigan@yahoo.com> wrote in message
news:OxJG8Hu2IHA.5024@TK2MSFTNGP03.phx.gbl...
> How would I do this:
>
> I have a server with a drive letter mapped to F:
> I need to copy some of the folders from F: to an existing folder on drive
> T:, which is on another server.
> Say the folder names on F: are Folder1 and Folder2. (there's actually
> about 10 folders)
> I want to copy Folder1 and Folder2 to drive T:
> How can I copy Folder1 and all it's sub-contents to T: without first
> creating a folder in the existing folder on T:
> I want to avoid, if possible, doing a: MD t:\Folder1 and copying the
> contents of F:\Folder1
> In other words, I want the copy, or in this case, xcopy, command to create
> the folder name for me.
>
> Is there a way to do that?
>
> TIA
>


Have a look at "xcopy.exe /?". It tells you which switches to use
to create a target folder on the fly.


Reply With Quote
  #3 (permalink)  
Old 06-30-2008, 08:56 PM
JohnB
 
Posts: n/a
Re: Another batch file question

I see the /T switch, which "Creates the Directory Structure". But it says
it does not copy files.

What would I have to do, use the xcopy command with the /T switch, then
follow that with another xcopy command that actually does the copying?



"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:%23Ty$Rpu2IHA.1196@TK2MSFTNGP05.phx.gbl...
>
> "JohnB" <jbrigan@yahoo.com> wrote in message
> news:OxJG8Hu2IHA.5024@TK2MSFTNGP03.phx.gbl...
>> How would I do this:
>>
>> I have a server with a drive letter mapped to F:
>> I need to copy some of the folders from F: to an existing folder on drive
>> T:, which is on another server.
>> Say the folder names on F: are Folder1 and Folder2. (there's actually
>> about 10 folders)
>> I want to copy Folder1 and Folder2 to drive T:
>> How can I copy Folder1 and all it's sub-contents to T: without first
>> creating a folder in the existing folder on T:
>> I want to avoid, if possible, doing a: MD t:\Folder1 and copying the
>> contents of F:\Folder1
>> In other words, I want the copy, or in this case, xcopy, command to
>> create the folder name for me.
>>
>> Is there a way to do that?
>>
>> TIA
>>

>
> Have a look at "xcopy.exe /?". It tells you which switches to use
> to create a target folder on the fly.
>


Reply With Quote
  #4 (permalink)  
Old 06-30-2008, 09:24 PM
Pegasus \(MVP\)
 
Posts: n/a
Re: Another batch file question

A few quick tests with xcopy.exe would show you that
you can do almost anything with this command. Did you
try the /I switch?

"JohnB" <jbrigan@yahoo.com> wrote in message
news:utwi4tu2IHA.2060@TK2MSFTNGP02.phx.gbl...
>I see the /T switch, which "Creates the Directory Structure". But it says
>it does not copy files.
>
> What would I have to do, use the xcopy command with the /T switch, then
> follow that with another xcopy command that actually does the copying?
>
>
>
> "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
> news:%23Ty$Rpu2IHA.1196@TK2MSFTNGP05.phx.gbl...
>>
>> "JohnB" <jbrigan@yahoo.com> wrote in message
>> news:OxJG8Hu2IHA.5024@TK2MSFTNGP03.phx.gbl...
>>> How would I do this:
>>>
>>> I have a server with a drive letter mapped to F:
>>> I need to copy some of the folders from F: to an existing folder on
>>> drive T:, which is on another server.
>>> Say the folder names on F: are Folder1 and Folder2. (there's actually
>>> about 10 folders)
>>> I want to copy Folder1 and Folder2 to drive T:
>>> How can I copy Folder1 and all it's sub-contents to T: without first
>>> creating a folder in the existing folder on T:
>>> I want to avoid, if possible, doing a: MD t:\Folder1 and copying the
>>> contents of F:\Folder1
>>> In other words, I want the copy, or in this case, xcopy, command to
>>> create the folder name for me.
>>>
>>> Is there a way to do that?
>>>
>>> TIA
>>>

>>
>> Have a look at "xcopy.exe /?". It tells you which switches to use
>> to create a target folder on the fly.
>>

>



Reply With Quote
  #5 (permalink)  
Old 06-30-2008, 10:05 PM
JohnB
 
Posts: n/a
Re: Another batch file question

I hadn't tried the /I switch..... but I just did.

Here's the command I'm using in a batch file.

MD t:\%date:~4,2%%date:~7,2%%date:~-2%
xcopy f:\testing\*.* t:\%date:~4,2%%date:~7,2%%date:~-2% /S /E /I

I create the folder first, named from the current date.
Then I need to copy a folder (Testing) from F: to that newly created folder.
All I get on T: is the sub-contents of F:\testing
It doesn't create the folder TESTING on the fly


"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:%23ddqM9u2IHA.2332@TK2MSFTNGP03.phx.gbl...
>A few quick tests with xcopy.exe would show you that
> you can do almost anything with this command. Did you
> try the /I switch?
>
> "JohnB" <jbrigan@yahoo.com> wrote in message
> news:utwi4tu2IHA.2060@TK2MSFTNGP02.phx.gbl...
>>I see the /T switch, which "Creates the Directory Structure". But it says
>>it does not copy files.
>>
>> What would I have to do, use the xcopy command with the /T switch, then
>> follow that with another xcopy command that actually does the copying?
>>
>>
>>
>> "Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
>> news:%23Ty$Rpu2IHA.1196@TK2MSFTNGP05.phx.gbl...
>>>
>>> "JohnB" <jbrigan@yahoo.com> wrote in message
>>> news:OxJG8Hu2IHA.5024@TK2MSFTNGP03.phx.gbl...
>>>> How would I do this:
>>>>
>>>> I have a server with a drive letter mapped to F:
>>>> I need to copy some of the folders from F: to an existing folder on
>>>> drive T:, which is on another server.
>>>> Say the folder names on F: are Folder1 and Folder2. (there's actually
>>>> about 10 folders)
>>>> I want to copy Folder1 and Folder2 to drive T:
>>>> How can I copy Folder1 and all it's sub-contents to T: without first
>>>> creating a folder in the existing folder on T:
>>>> I want to avoid, if possible, doing a: MD t:\Folder1 and copying the
>>>> contents of F:\Folder1
>>>> In other words, I want the copy, or in this case, xcopy, command to
>>>> create the folder name for me.
>>>>
>>>> Is there a way to do that?
>>>>
>>>> TIA
>>>>
>>>
>>> Have a look at "xcopy.exe /?". It tells you which switches to use
>>> to create a target folder on the fly.
>>>

>>

>
>


Reply With Quote
  #6 (permalink)  
Old 06-30-2008, 10:40 PM
Pegasus \(MVP\)
 
Posts: n/a
Re: Another batch file question


"JohnB" <jbrigan@yahoo.com> wrote in message
news:%23NyJZUv2IHA.4164@TK2MSFTNGP03.phx.gbl...
>I hadn't tried the /I switch..... but I just did.
>
> Here's the command I'm using in a batch file.
>
> MD t:\%date:~4,2%%date:~7,2%%date:~-2%
> xcopy f:\testing\*.* t:\%date:~4,2%%date:~7,2%%date:~-2% /S /E /I
>
> I create the folder first, named from the current date.
> Then I need to copy a folder (Testing) from F: to that newly created
> folder.
> All I get on T: is the sub-contents of F:\testing
> It doesn't create the folder TESTING on the fly


I would have been very surprised if your command had
created the folder "testing", since you're copying the
***contents*** of the "testing" folder, not the folder
itself. It's like saying "give me the contents of your
wallet" or "give me your wallet". Not the same at all!

Also: why the belts and braces approach? The /I switch
will create the destination folder, so why create it
manually too?

Have a look at the other switches below. They are essential
when operating the command in a batch file.

set MyDate=%date:~4,2%%date:~7,2%%date:~-2%
xcopy /s /e /i /y /d f:\testing "t:\%MyDate%\Testing"


Reply With Quote
  #7 (permalink)  
Old 07-01-2008, 01:14 PM
JohnB
 
Posts: n/a
Re: Another batch file question

Worked like a charm!!
Thank you.

> Also: why the belts and braces approach?

Haven't played with this enough.

It's a cludge of a backup but, it's what they wanted.



"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:eueqbnv2IHA.3544@TK2MSFTNGP05.phx.gbl...
>
> "JohnB" <jbrigan@yahoo.com> wrote in message
> news:%23NyJZUv2IHA.4164@TK2MSFTNGP03.phx.gbl...
>>I hadn't tried the /I switch..... but I just did.
>>
>> Here's the command I'm using in a batch file.
>>
>> MD t:\%date:~4,2%%date:~7,2%%date:~-2%
>> xcopy f:\testing\*.* t:\%date:~4,2%%date:~7,2%%date:~-2% /S /E /I
>>
>> I create the folder first, named from the current date.
>> Then I need to copy a folder (Testing) from F: to that newly created
>> folder.
>> All I get on T: is the sub-contents of F:\testing
>> It doesn't create the folder TESTING on the fly

>
> I would have been very surprised if your command had
> created the folder "testing", since you're copying the
> ***contents*** of the "testing" folder, not the folder
> itself. It's like saying "give me the contents of your
> wallet" or "give me your wallet". Not the same at all!
>
> Also: why the belts and braces approach? The /I switch
> will create the destination folder, so why create it
> manually too?
>
> Have a look at the other switches below. They are essential
> when operating the command in a batch file.
>
> set MyDate=%date:~4,2%%date:~7,2%%date:~-2%
> xcopy /s /e /i /y /d f:\testing "t:\%MyDate%\Testing"
>
>


Reply With Quote
  #8 (permalink)  
Old 07-01-2008, 01:36 PM
Pegasus \(MVP\)
 
Posts: n/a
Re: Another batch file question

Thanks for the feedback.

"JohnB" <jbrigan@yahoo.com> wrote in message
news:ehJ7GQ32IHA.1420@TK2MSFTNGP06.phx.gbl...
> Worked like a charm!!
> Thank you.
>
>> Also: why the belts and braces approach?

> Haven't played with this enough.
>
> It's a cludge of a backup but, it's what they wanted.



Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > Windows Server


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 01:29 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Mobile Phone | Mortgage Calculator | Loans | Xecuter 3 Mod Chip | Mobile Phone



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114