Solved

Script to Find and combine multiple files into one on a move

Posted on 2013-10-28
4
403 Views
Last Modified: 2013-10-28
I am running into a issue trying to come up with a script (.bat preferably but not absolute) file. I think the issue is finding the right terms to search for.

What I need is to search a directory for certain files that day that begin with similar text (one day there may be 4 files and the next there may be 10), grab all those files and move them to a different location and concatenate them. The trick is they need to all be combined into one file and given a different name.

I know it will be some type of move function and maybe grabs them a does some type of append... but not real sure.

Example:
Script runs
Grabs files from \\server\share1 named fileAB1.txt, fileAB2.txt, fileAC1.txt (so any files with fileA*.txt )
Moves the files to \\server2\share2 and combines the txt and leave a single file named CombinedA%date%.txt


These will all be text files.

thanks ahead of time.
0
Comment
Question by:ChesterfieldFire
  • 2
  • 2
4 Comments
 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 39605862
This realtively easy with the copy command, which allows concatenation.

So you can get all the files starting with say ABC and move them to a new location with a copy and then a delete, as in:

copy C:\dir1\abc*.* D:\dir2\newfile.txt
del C:\dir1\abc*.*

Make sense?

~bp
0
 

Author Comment

by:ChesterfieldFire
ID: 39605890
I will give it a test now. Thanks!
0
 

Author Comment

by:ChesterfieldFire
ID: 39605912
Awesome thanks Bill. Perfect. I knew it would be something I just could not search properly, but that seemed really easy :)
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 39605935
Welcome, glad that helped.

~bp
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now