File Commands Dos Batch
Updated: 06/09/2012 10:22 AM

Combine multible files into 1
copy *.txt mytextfile.txt

Copy all directory names into a text file
dir /ad >list.txt

Copy all filenames into a text file
dir /a /-p /b /o:gen >list.txt

Copy all filenames with extra info into a text file
dir /a /-p /o:gen >list.txt

Compare 2 files
FC file.txt file2.txt

Search or Find a file
Dir c:\ /s /b | find "nade.txt"

See a tree structure of current directory
Tree > dirstructure.txt
Type dirstructure.txt

Copy Files to another place
@echo off

set LISTFOLDER=I:\Viborg\Final
set FILESPATH=I:\Viborg\Final\AlmeneArkiv\XML
set DESTPATH=I:\Viborg\Final\CopiedTo

for /f "tokens=*" %%i in ('dir /b ^"%LISTFOLDER%\*.txt^"') do (call :COPY_FILES "%LISTFOLDER%\%%i")

pause


:COPY_FILES
for %%i in (%1) do set DEST=%%~ni
for /f "usebackq delims==" %%i in (%1) do xcopy /qv "%FILESPATH%\%%i" "%DESTPATH%\%DEST%\*"


Files to copy should be saved in a text file as :
7.xml
8.xml
9.xml
10.xml
99.xml


Url to this pages:
http://nade.dk/web/nade/site.nsf/FramesetHP?readform&wmain=files/File_Commands_Dos