Solved

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

Posted on 2013-10-28
4
416 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 54

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 54

Expert Comment

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

~bp
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
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 …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

730 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