for %I in (*.txt) do @echo ====%~nxI >>allfiles.txt && type "%~nxI" >>allfiles.txt"====" is just a marker to make it easier to search/page through, you can use whatever you want, or nothing at all.
@ECHO OFF ECHO Creating %1... FOR /F "usebackq tokens=1" %%i IN (`DIR /B`) DO ( ECHO Adding %%i ECHO. >> %1 ECHO === %%i: >> %1 TYPE %%i >> %1 )Here is example usage (I called the script concatem.cmd):
C:\test\files>..\concatem.cmd everything.txt Creating everything.txt... Adding file1.txt Adding file2.txt Adding file3.txt C:\test\files>type everything.txt === file1.txt: this is file one. === file2.txt: this is file two. === file3.txt: this is file three. C:\test\files>dir Volume in drive C has no label. Volume Serial Number is 9840-A7ED Directory of C:\test\files 09/12/2009 07:47 PMNote that if you create the script and run it from the same directory as the files, it will include the script in the output file. You could modify the script to exclude it, or just remove it by hand.. 09/12/2009 07:47 PM .. 09/12/2009 07:47 PM 119 everything.txt 09/12/2009 07:45 PM 19 file1.txt 09/12/2009 07:45 PM 19 file2.txt 09/12/2009 07:46 PM 21 file3.txt 4 File(s) 178 bytes 2 Dir(s) 22,012,522,496 bytes free
import os, time
fileList=os.listdir('.')
fileList.sort()
for fileName in fileList:
fileStats = os.stat(fileName)
fileDate = time.localtime(fileStats[8])
fileDate = time.strftime("%m/%d/%y %H:%M:%S", fileDate)
print "*** FILE: %s\t\tDATE: %s" % (fileName, fileDate)
fileCurrent = open(fileName)
print fileCurrent.read()c:\python26\python mefi.pyfor %I in (*.txt) do @echo ====%~nxI >>allfiles.txt && echo %~tI >>allfiles.txt && type "%~nxI" >>allfiles.txt
for %I in (*.txt) do @echo ====%~tnxI >>allfiles.txt && type "%~nxI" >>allfiles.txt
cd \Users\user01\notesThat puts you in the directory where all your notes are. Then enter
for %I in (*.txt) do @echo ====%~nxI >>allfiles.txt && echo %~tI >>allfiles.txt && type "%~nxI" >>allfiles.txtThe for %I in (*.txt) part doesn't need to be changed at all. It tells Windows, "Run the following commands on every .txt file in the current directory."
You are not logged in, either login or create an account to post comments
posted by sun-el at 7:39 PM on September 12