|
Answer» I am appending to a file called EDI_Results.txt.
I am USING "dir >> C:\FTPData\EDI\EDI_Results.txt" to append the current directory to the file EDI_Results.txt. The file ends up looking like this.....
=============== BRIDIUM EXPORT ================== Volume in drive C is OS Volume Serial Number is 709D-2487
Directory of C:\FTPData\EDI\Export
05/14/2010 08:58 AM . 05/14/2010 08:58 AM .. 05/15/2009 04:59 PM 2003 05/15/2009 04:59 PM 2004 05/15/2009 04:59 PM 2005 05/15/2009 04:59 PM 2006 05/15/2009 04:59 PM 2007 05/15/2009 04:59 PM 2008 05/15/2009 04:58 PM 2009 12/23/2009 11:02 AM 2010 05/13/2010 06:52 PM 76,963 bridium.txt 05/15/2009 04:58 PM MMI 05/13/2010 09:00 PM 708,721 MMIClaimExtraction 05/13/2010 04:44 PM PROCESSES 07/30/2009 08:25 AM StateIN 2 File(s) 785,684 bytes 13 Dir(s) 51,192,061,952 bytes free ================= BRIDIUM IMPORT ===================== ================= BRIDIUM IMPORT ===================== Volume in drive C is OS Volume Serial Number is 709D-2487
Directory of C:\FTPData\EDI\Import
05/14/2010 08:05 AM . 05/14/2010 08:05 AM .. 05/15/2009 04:58 PM 2004 05/15/2009 04:58 PM 2005 05/15/2009 04:58 PM 2007 05/15/2009 04:58 PM 2008 05/15/2009 04:58 PM 2009 12/23/2009 11:04 AM 2010 05/14/2010 08:05 AM 6,859 Acks20100513200122.txt 05/14/2010 08:05 AM 19,486 Acks20100513210106.txt 05/14/2010 08:05 AM 13,753 Acks20100513220230.txt 05/15/2009 04:58 PM Archive Test 05/15/2009 04:58 PM iVOS 05/14/2010 08:05 AM LastWeeksFiles 05/15/2009 04:58 PM PROCESSES 05/15/2009 04:58 PM save 05/15/2009 04:58 PM State 05/15/2009 04:58 PM Success 05/15/2009 04:58 PM Test 3 File(s) 40,098 bytes 16 Dir(s) 51,192,061,952 bytes free
All I am really looking for is the files, date and size included. I want it to look cleaner. Is there any way to just append the files in the directory with the date stamp and file size??My .bat file LOOKS like this...
ftp -s:Bridiumexport.txt C: cd\ cd FTPData\EDI\Export echo >> C:\FTPData\EDI\EDI_Results.txt =============== BRIDIUM EXPORT ================== dir >> C:\FTPData\EDI\EDI_Results.txt dir This may work:
CODE: [Select]ftp -s:Bridiumexport.txt C: cd\ cd FTPData\EDI\Export echo >> C:\FTPData\EDI\EDI_Results.txt =============== BRIDIUM EXPORT ================== for /f "tokens=* delims=" %%i in ('dir /s /b') do ( echo %%~TI %%~zi %%~ni%%~xi >> C:\FTPData\EDI\EDI_Results.txt ) type C:\FTPData\EDI\EDI_Results.txt
Good luck. Worked like a champ!
Thanks for your help!I spoke to soon. It worked in my test environment, but when I applied it to production, It brought in all directories and files of the parent folder...please help...
================= BRIDIUM IMPORT ===================== 05/15/2009 04:58 PM02004 05/15/2009 04:58 PM02005 05/15/2009 04:58 PM02007 05/15/2009 04:58 PM02008 05/15/2009 04:58 PM02009 12/23/2009 11:04 AM02010 05/15/2009 04:58 PM0Archive Test 05/15/2009 04:58 PM0iVOS 05/14/2010 08:05 AM0LastWeeksFiles 05/15/2009 04:58 PM0PROCESSES 05/15/2009 04:58 PM0save 05/15/2009 04:58 PM0State 05/15/2009 04:58 PM0Success 05/15/2009 04:58 PM0Test 05/15/2009 04:58 PM020040225a 05/15/2009 04:58 PM020040308a 05/15/2009 04:58 PM020040330a 05/15/2009 04:58 PM020040429a 05/15/2009 04:58 PM020040607a 05/15/2009 04:58 PM020040610a 05/15/2009 04:58 PM020040611a 05/15/2009 04:58 PM020040616a...
------------------------------------------------------------------------------
My bat file looks like this...
ftp -s:Bridiumimport.txt C: cd\ cd FTPData\EDI\Import echo > C:\FTPData\EDI\EDI_Results.txt ================= BRIDIUM IMPORT ===================== for /f "tokens=* delims=" %%i in ('dir /s /b') do (echo %%~ti%%~zi%%~ni%%~xi >> C:\FTPData\EDI\EDI_Results.txt) type C:\FTPData\EDI\EDI_Results.txt Quick fix. Remove the recurse switch (/s).
Code: [Select]ftp -s:Bridiumimport.txt C: cd\ cd FTPData\EDI\Import echo > C:\FTPData\EDI\EDI_Results.txt ================= BRIDIUM IMPORT ===================== for /f "tokens=* delims=" %%i in ('dir /b') do (echo %%~ti %%~zi %%~ni%%~xi >> C:\FTPData\EDI\EDI_Results.txt) type C:\FTPData\EDI\EDI_Results.txt
Hope this helps. That TOOK care of the child directory issue, but it is still pulling in folders from the parent directory. Anyway to just pull in files and not include the folders?Code: [Select]ftp -s:Bridiumimport.txt C: cd\ cd FTPData\EDI\Import echo > C:\FTPData\EDI\EDI_Results.txt ================= BRIDIUM IMPORT ===================== for /f "tokens=* delims=" %%i in ('dir /a-d /b') do (echo %%~ti %%~zi %%~ni%%~xi >> C:\FTPData\EDI\EDI_Results.txt) type C:\FTPData\EDI\EDI_Results.txt
Run dir /? from command prompt for details on the dir command Run for /? from command prompt for details on the for command
The for help (at the very end) will also have details how to extract the full path of the file name in case you want the same format as my original post.
Thank you very much for your help.Oh yeah.......
This did it......
for /f "tokens=* delims=" %%i in ('dir /a:a /o:s /b') do (echo %%~ti%%~zi%%~ni%%~xi >> EDI_Results.txt)This works also....
for /f "tokens=* delims=" %%i in ('dir /a:-d /o:s /b') do (echo %%~ti %%~zi%%~ni%%~xi >> EDI_Results.txt)
|