Search found 244 matches

by Endoro
22 Oct 2013 21:00
Forum: DOS Batch Forum
Topic: Cannot display a large record(Ex:more than 5000 characters)
Replies: 15
Views: 5011

Re: Cannot display a large record(Ex:more than 5000 characte

remove the first and the last line of a text file:

Code: Select all

type text.txt|findrepl /o:2:-2
by Endoro
10 Oct 2013 20:55
Forum: DOS Batch Forum
Topic: Automatically deleting oldest directories
Replies: 13
Views: 4428

Re: Automatically deleting oldest directories

'if not' works only for very few folders-to-ignore.
If you have a lot of it better take 'findstr'.
by Endoro
09 Oct 2013 18:55
Forum: DOS Batch Forum
Topic: Automatically deleting oldest directories
Replies: 13
Views: 4428

Re: Automatically deleting oldest directories

yes, just put 'forfiles' in a 'for /f' loop and send the output through 'findstr'.
by Endoro
07 Oct 2013 12:36
Forum: DOS Batch Forum
Topic: Automatically deleting oldest directories
Replies: 13
Views: 4428

Re: Automatically deleting oldest directories

try this (make a backup before):

Code: Select all

@echo off
forfiles /p "G:\VERITAS\B2D"  /d -5 /c "cmd /c if @isdir==TRUE rd /s /q @path"

Also look at "forfiles /?" at the command prompt.
by Endoro
30 Sep 2013 13:23
Forum: DOS Batch Forum
Topic: Batch file to create file on todays date
Replies: 2
Views: 1658

Re: Batch file to create file on todays date

try this: @echo off &setlocal for /f "tokens=2delims==" %%a in ('wmic os get localdatetime /value') do set "mydate=%%a" set "mydate=%mydate:~6,2%%mydate:~4,2%%mydate:~2,2%" for %%a in (A,B,C) do type nul>%mydate%%%a.TXT dir %mydate%?.TXT This works for XP Pro or bet...
by Endoro
25 Sep 2013 07:40
Forum: DOS Batch Forum
Topic: please help extracting links from a source-code of html file
Replies: 7
Views: 2758

Re: please help extracting links from a source-code of html

wget & grep wget -O- "http://fbcmd.dtompkins.com/commands/allinfo" 2>nul|grep -Eo "http://fbcmd.(\w+).(\w+)(/\w+)+" this needs some more work: http://fbcmd.dtompkins.com/_/rsrc/1301314156558/config/fbcmd138x52 http://fbcmd.dtompkins.com/parameters/flist http://fbcmd.dtompkins...
by Endoro
04 Sep 2013 07:45
Forum: DOS Batch Forum
Topic: Fastest sin(x) in dos batch
Replies: 36
Views: 21296

Re: Fastest sen(x) in dos batch

please look here.
by Endoro
29 Aug 2013 14:37
Forum: DOS Batch Forum
Topic: Format datetime from a files modified date
Replies: 5
Views: 2347

Re: Format datetime from a files modified date

you can try this: @echo off & SETLOCAL SET "var=1/1/2013 7:26 AM" FOR /f "tokens=1-3delims=/ " %%a IN ("%var%") DO ( SET "month=0%%a" SET "day=0%%b" SET "year=%%c" ) SET "month=%month:~-2%" SET "day=%day:~-2%" SET &q...
by Endoro
29 Aug 2013 01:42
Forum: DOS Batch Forum
Topic: Copying a file to a new filename in each folder
Replies: 12
Views: 3311

Re: help sought

I made some edits....

Code: Select all

for /d /r %%a in (*) do copy "%%~fa\%%~na.tbn" folder.jpg
by Endoro
23 Aug 2013 03:46
Forum: DOS Batch Forum
Topic: need to only select the time of the oldest file
Replies: 1
Views: 931

Re: need to only select the time of the oldest file

to grab the oldest "print" the youngest first:

Code: Select all

for /f "delims=" %%a in ('dir /b /o-d /a-d') do SET  "filedate=%%~ta"
echo %filedate%
by Endoro
23 Aug 2013 02:12
Forum: DOS Batch Forum
Topic: make an output appear in the same line
Replies: 3
Views: 1419

Re: make an output appear in the same line

you might try this: @ECHO OFF &SETLOCAL ENABLEDELAYEDEXPANSION FOR /f "usebackqdelims=" %%a IN (`wmic service where 'startmode^="auto" and state^="stopped"' get name`) DO ( FOR /f %%b IN ("%%~a") DO ( SET /a counter+=1 IF !counter! gtr 1 SET "line=!li...
by Endoro
20 Aug 2013 00:46
Forum: DOS Batch Forum
Topic: Group in folder
Replies: 12
Views: 4302

Re: Group in folder

please explain exactly what registry key you mean.
Btw. it is not necessary and desired to write the whole text in bold letters.
by Endoro
20 Aug 2013 00:41
Forum: DOS Batch Forum
Topic: Archiving of Files
Replies: 6
Views: 2224

Re: Archiving of Files

try this:

Code: Select all

for /f "delims=" %%a in (Source_filelist.txt) do "archive program" a "my archive" "%%~a"
by Endoro
19 Aug 2013 06:39
Forum: DOS Batch Forum
Topic: Archiving of Files
Replies: 6
Views: 2224

Re: Archiving of Files

try this:

Code: Select all

7za a "my archive" "@Source_filelist.txt"