Web Hosting, Design, & Coding forum

Question

Help required with file copy script/ batch file please !

by themuzzr / November 17, 2011 5:39 AM PST

Hi i'm a scripting newbie and require some help with a script i am trying to writ.

What I need to do is to. Replicate a folder called "migration" to every folder within a directory.

I have a script which will copy a folder (from file path writen into the script)
Into a folder within the directory (also written into the script) but have no idea how to make it write to all folders within the directory.

I have also tried writing a batch file which enumerates all the folders within the directory and then exports them to c:\folderlist.xml

I have been trying to use robocopy to copy "migration" to every folder within the directory using the .xml as the reference but not having much luck.

Is anyone in a position to help me please ?

Discussion is locked
You are posting a reply to: Help required with file copy script/ batch file please !
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Help required with file copy script/ batch file please !
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.

All Answers

Collapse -
Answer
Read posts 8, 9 and 10 at link.
by R. Proffitt Forum moderator / November 17, 2011 5:49 AM PST
http://www.webhostingtalk.com/showthread.php?t=490919
Collapse -
Thanks but i need a command to copy folders :)
by themuzzr / November 17, 2011 7:15 AM PST

Thanks !

The link was helpfull but dosn't bring me any closer to what I require Happy That command will copy files to every folder but not folders.

I am trying to copy a folder called "migration" to all top level folders within a directory.

I have tried using robocopy. Can anyone help ? Happy 1 folder to many within a single directory ?

Thanks Muz

Collapse -
I think you are looking for
by R. Proffitt Forum moderator / November 17, 2011 7:22 AM PST

While the link I gave helps us script a copy to each folder I think what you are really looking for is the exact solution without having to create it on your own.

Let's hope some programmer here will pop in soon but your task would be done in about 2 minutes with that folder on your desktop and a drag and drop to the folders one by one in the explorer pane.
Bob

Collapse -
Stil havn't found what I'm looking for !
by themuzzr / November 17, 2011 7:53 AM PST

HI

Well you are half right !! I am looking for some help with the solution .... but i have been trying to create it myself !
However my I think i am fairly limited by my knowledge of the robocopy/xcopy/copy command and syntax's, I have searched tech net and created loads of batch files which will copy/ replicate my "migration" folder to a specified(in the script) folder.

I have also tried a VBS but again my limited knowledge has only allowed me to to write a script to copy the "migration" folder to one specified(in the script) folder. !!!

However my problem is getting the command to replicate to all top level folders within the specified directory.

I also agree that drag and drop from/to windows explorer is a solution ..... not when this replication needs to be done 1000's of times and not only for this one off task Happy

Let's hope a programmer can help me out !

Thanks for your help anyway

Muz

Collapse -
Re: script
by Kees_B Forum moderator / November 17, 2011 5:19 PM PST

I see 2 options:
1. Write a simple vbscript that generates a batch file that uses xcopy /s to do the job. That file should have 1 line for each target folder.
2. Write a more complex vbscript that does it all itself, recursively.

There might be alternatives by using powershell, but I don't know that.

As this seems to be for work, there should be money to pay someone to write it if you can't do it yourself.

Kees

Collapse -
I think Kees has it nailed.
by R. Proffitt Forum moderator / November 18, 2011 12:01 AM PST

Vbscript opens the door for a richer script language. And it's more likely to work across machines.

It's also an easier language to pick up than COMMAND.COM or CMD.EXE scripting.
Bob

Collapse -
Nailed nothing
by themuzzr / November 18, 2011 1:06 AM PST

To be honest Kees hasn't nailed anything ! He has stated the obvious !

I have a problem (due to my lack of subject matter knowledge) and am seeking help !!

I you are not in a position to offer any ! Please don't waste your time answering ! Lol !!

It's like someone whos been trying to fix their cars alternater, posting asking any mechanics how to replace the brushes..... only to be told.

Yes you have a problem ... you can either :
1 Call out a Mechanic
2 Go to a garage
3 Go to Mechanic school for a couple of years then you'll know how

All i'm asking for is some help !!! I seriously wonder sometimes why people cannot just help each other out in this day and age !!

Unbelievable !!!

Collapse -
Sorry but rarely do others write the code for you.
by R. Proffitt Forum moderator / November 18, 2011 1:14 AM PST
In reply to: Nailed nothing
Popular Forums
icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

CNET FORUMS TOP DISCUSSION

Help, my PC with Windows 10 won't shut down properly

Since upgrading to Windows 10 my computer won't shut down properly. I use the menu button shutdown and the screen goes blank, but the system does not fully shut down. The only way to get it to shut down is to hold the physical power button down till it shuts down. Any suggestions?