Solved

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

Posted on 2013-10-28
4
411 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 53

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 53

Expert Comment

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

~bp
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to use a desktop short cut Target path to include a .ini file 4 57
Xcopy / Robocopy Question 7 64
Batch to Restart Remote Computers 4 86
xcopy loop 13 54
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…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

816 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

13 Experts available now in Live!

Get 1:1 Help Now