Computing.Net > Forums > Programming > Write file names from multiple dir to a txt

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Write file names from multiple dir to a txt

Reply to Message Icon

Name: tcerveny
Date: October 30, 2009 at 12:24:22 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

What I need to do is search one ROOT DIR (FTP) and find all files listed in any DIR with a filter for MODIFIED DATE > 9/1/2008. I thought to use a batch file, but maybe VBS would work as well. There are MANY DIR's within the FTP ROOT. Then I would need to output the FILENAMES that meet criteria of the DATE to output to a delimited TXT so that I have 'UNCpath|filename|datemodified'



Sponsored Link
Ads by Google

Response Number 1
Name: nbrane
Date: October 31, 2009 at 00:54:04 Pacific
Reply:

from looking in this forum, there's a way to change date format in Xp. (possibly even specific to "dir" cmd). if so, the
easiest way would be change format to yyyy[/]mm[/]dd,
do "dir /s | sort /r > filenam", then just read through the file until the substringim is less than 20080901 or equiv (dep on
delimiter: /,-,etc) then have batchfile change date format back to normal. my guess is that Xp's DIR might even have a
switch to alternative-format date then your batch would not have to change system-wide settings for small-scale op.
i know this not much help. if my Xp system was working i
could be more specific and test some things.


0

Response Number 2
Name: nbrane
Date: November 4, 2009 at 22:41:18 Pacific
Reply:

the foll. might work (not complete, just working segment)

setlocal enableDelayedExpansion
for /f "tokens=*, delims=" in ('dir /s /tw') do (
set c=%%a
if "!c:~1,13! equ "Directory of " set p=!c:~13,200!


if "!c:~0,1!" neq " " (
set b=!c:~6,4!!c~0,2!!c~3,2!
set f=!c:~39,200!
if "!b!" gtr "20080901" do (
echo !p!, !f!, !b! >> test))

may need a couple other tests to skip the garbage from coming into "test" (the headings etc.)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Write file names from multiple dir to a txt

Extract an excel page to a txt file www.computing.net/answers/programming/extract-an-excel-page-to-a-txt-file/17053.html

batch file name from selected file www.computing.net/answers/programming/batch-file-name-from-selected-file/15658.html

Creating a variable from a txt file www.computing.net/answers/programming/creating-a-variable-from-a-txt-file/16486.html