Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Dev Hardware ForumsSOFTWAREProgramming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Hardware Forums Sponsor:
  Trader Rating: 0 · #1  
Old May 10th, 2009, 07:40 PM
xterm11 xterm11 is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 1 xterm11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 18 sec
Reputation Power: 0
Exclamation DOS Batch - XCOPY or COPY to child directories

How can I copy a file into an unknown child directory?
For example:

MainFolder
|
|--Folder1
|
|--Folder2
| |
| |--Where Log.txt should be copied to
|
|--Folder3
| |
| |--Where Log.txt should be copied to
|
|--Example.bat
|
|--Log.txt

In the above example file tree, I want "Example.bat" to copy "Log.txt" into all of the children("Folder2" and "Folder3") of the file Example.bat is located in(Folder1). The problem is that I don't know the name of Folder1, Folder2, or Folder3.

So in this example I would need "Example.bat" to copy "Log.txt" into "Folder2" and "Folder3".

The only way I can think of doing this is to use something like DIR (Which shows all folders and files in the current folder you run your batch in), and the wild card symbol(*).

I know how to copy into a parent directory:

Code:
COPY log.txt ..


But, I have no clue how to copy into a child directory. Thanks in advance for help,

Xterm11

Reply With Quote
  Trader Rating: 0 · #2  
Old July 28th, 2009, 05:38 AM
Codex-M's Avatar
Codex-M Codex-M is offline
Contributing User
Click here for more information.
 
Join Date: Jun 2008
Posts: 320 Codex-M User rank is First Lieutenant (10000 - 20000 Reputation Level)Codex-M User rank is First Lieutenant (10000 - 20000 Reputation Level)Codex-M User rank is First Lieutenant (10000 - 20000 Reputation Level)Codex-M User rank is First Lieutenant (10000 - 20000 Reputation Level)Codex-M User rank is First Lieutenant (10000 - 20000 Reputation Level)Codex-M User rank is First Lieutenant (10000 - 20000 Reputation Level)Codex-M User rank is First Lieutenant (10000 - 20000 Reputation Level)Codex-M User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Days 6 h 37 m 41 sec
Reputation Power: 141
Quote:
Originally Posted by xterm11
How can I copy a file into an unknown child directory?
For example:

MainFolder
|
|--Folder1
|
|--Folder2
| |
| |--Where Log.txt should be copied to
|
|--Folder3
| |
| |--Where Log.txt should be copied to
|
|--Example.bat
|
|--Log.txt

In the above example file tree, I want "Example.bat" to copy "Log.txt" into all of the children("Folder2" and "Folder3") of the file Example.bat is located in(Folder1). The problem is that I don't know the name of Folder1, Folder2, or Folder3.

So in this example I would need "Example.bat" to copy "Log.txt" into "Folder2" and "Folder3".

The only way I can think of doing this is to use something like DIR (Which shows all folders and files in the current folder you run your batch in), and the wild card symbol(*).

I know how to copy into a parent directory:

Code:
COPY log.txt ..


But, I have no clue how to copy into a child directory. Thanks in advance for help,

Xterm11


I think this one can help you:

http://home.att.net/~gobruen/progs/dos_batch/dos_batch.html

What you are trying to accomplish is something a bit complicated, you can run maybe an IF command using batch file, but since you do not know the names of those child directories, maybe to avoid some error you can test them first if it did exist in the first place. Hope this helps.

Reply With Quote
Reply

Viewing: Dev Hardware ForumsSOFTWAREProgramming > DOS Batch - XCOPY or COPY to child directories


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
     
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 7 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek