English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I use the following command to combine multiple files into one.
copy "c:\x\y\z\Combine Work\*.avi.*" /b "c:\x\y\z\Combine Work\combined.avi" /b

I have used the full address of the file (names have been shortened). I use the command in a bat file called combine.bat.

Is there a way to modify the address so it will automatically use the files within the folder that the bat file is in? I don't want to use a change directory command since I want it to work in any folder automatically. Now it only works in the "Combine Work" folder. I would like it to work in any folder without modification.

2007-08-14 13:12:38 · 5 answers · asked by Barkley Hound 7 in Computers & Internet Programming & Design

It does work as I wanted as
copy "*.avi.*" /b "combined.avi" /b
with the bat file in the folder with the avi files.

The copy command works great when doing a merge. These are not separate AVI files but actual segments of the whole that are downloaded from binary newsgroups. There may be other ways to combine them but I have used this method for years with no problem.

2007-08-14 13:45:55 · update #1

5 answers

if you just use the file name without a preceding path, it will take the files from the folder you are currently pointing at

so *.avi.* instead of c:\x\y\z\Combine Work\*.avi.* should work in the current folder (assuming that the current path equates with the current folder). mind you, that filename looks pretty strange, i have to say.

2007-08-14 13:25:18 · answer #1 · answered by Anonymous · 2 1

you'd be wanting to use the 'xcopy' command instead, it has the ability to work with subdirectories and such.

i haven't had call to use the xcopy command myself in alot of years, but for extra simplicity i'd probably dump all subdirectories to a txt file first:
dir /ad /b > folders.txt (windows vista)
dir,ad -b > folders.txt (windows xp - i think, use dir /? to check)

you can then read the text file as input for command line programs by using: command name < folders.txt.

on a side note, using a copy command to combine video files is not advised and causes errors if you should ever wish to convert them to another format, or dvd, or whatever.

unless there's a 100% unmoveable reason to do this using only 'native' dos commands you should switch to a windows alternative that will do this with a couple of clicks.

EDIT:
i would still maintain that using a dos command (be it 'copy' OR 'xcopy') to join files is a laborous and overly complex way to accomplish this, given the simplicity of other alternatives.

the following site may be of more interest to you:
http://www.afterdawn.com/guides/archive/introducing_usenet_binary_groups_page_5.cfm

anyhoo, using the xcopy command you can copy files from many subdirectories into one main directory (as long as there are no conflicting filenames) and then run the copy command on them to merge into one OR use the aforementioned method of using a text file containing subdirectory names to process one directory at a time using a looped subroutine in a batch file.

2007-08-14 20:15:54 · answer #2 · answered by piquet 7 · 1 0

Instead of using the full directory path try just using the file names:

For example, the following command would copy any files starting with "January", followed by any other characters and then ending with the extension .txt and combine them into a file called "test3.txt".
copy "January*.txt" /b test3.txt /b

This command will work in any directory when run in a .cmd file since the working directory of the file is the current directory.

I hope this helps!
Scott
http://ComputersConfuseMe.com

2007-08-14 20:31:39 · answer #3 · answered by sancho 2 · 2 1

Here is an index of DOS commands. I didn't think anyone worked in DOS anymore.

http://www.easydos.com/dosindex.html

2007-08-14 20:17:28 · answer #4 · answered by TheHumbleOne 7 · 0 1

Why do you even use DOS anymore?!?!?!?! Thats why they have windows. Duh?

2007-08-14 20:23:32 · answer #5 · answered by EvilX 3 · 0 5

fedest.com, questions and answers