Search found 3974 matches

by Squashman
30 Dec 2011 08:50
Forum: DOS Batch Forum
Topic: multiple file type search
Replies: 9
Views: 2744

Re: multiple file type search

I save this batch file in c:\, after that I run the batch, it says can't perform a cycle copy, 0 files copied Of course that is going to happen if you execute it from the root of the drive. You said earlier that you wanted to copy to the D: drive though. If you were copying to a separate drive then...
by Squashman
30 Dec 2011 08:40
Forum: DOS Batch Forum
Topic: batch to automatically ping IPs
Replies: 3
Views: 2565

Re: batch to automatically ping IPs

Just wondering why you are using one batch file to call another batch file when this could all easily be done in one batch file?
by Squashman
28 Dec 2011 10:44
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 32
Views: 22870

Re: infinite loop with break condition

I was reading this over at stack overflow again. m Would this work for you. @echo off & setlocal EnableDelayedExpansion if "%1"=="loop" ( set /a num=0 for /l %%f in (1 0 10) do ( set /a num+=1 IF "!num!"=="500" echo.>%%f.tmp if exist %%f.tmp exit ) goto :e...
by Squashman
28 Dec 2011 08:48
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 32
Views: 22870

Re: infinite loop with break condition

Was reading something over at Stack Overflow. This creates your infinite loop with a break but is also kills your batch file. Which would also be pointless. @echo off & setlocal EnableDelayedExpansion set /a num=0 for /L %%N in (1 0 10) do ( set /a num+=1 CALL :loop !num! ) :__loop () :loop IF &...
by Squashman
27 Dec 2011 12:31
Forum: DOS Batch Forum
Topic: delete 2 days older folders
Replies: 18
Views: 6092

Re: delete 2 days older folders

Posting a link to a script written on another forum by an old buddy of mine (TheOutcaste). m This script should work for you and it doesn't rely on what your DATE variable is. Credit is given throughout the script from whom wrote the original code. I can show you what lines you need to change for yo...
by Squashman
27 Dec 2011 11:57
Forum: DOS Batch Forum
Topic: delete 2 days older folders
Replies: 18
Views: 6092

Re: delete 2 days older folders

And squashman, that is what my script also doing, it is also keeping the two latest folders. But i want to keep other folders also which are not of month-date format. Regards, My script does not touch your XYZ or ABC folders. I pipe the output of the DIR command to the FINDSTR command. The findstr ...
by Squashman
27 Dec 2011 11:23
Forum: DOS Batch Forum
Topic: delete 2 days older folders
Replies: 18
Views: 6092

Re: delete 2 days older folders

And squashman, that is what my script also doing, it is also keeping the two latest folders. But i want to keep other folders also which are not of month-date format. Regards, My script does not touch your XYZ or ABC folders. I pipe the output of the DIR command to the FINDSTR command. The findstr ...
by Squashman
27 Dec 2011 06:48
Forum: DOS Batch Forum
Topic: delete 2 days older folders
Replies: 18
Views: 6092

Re: delete 2 days older folders

I should note that technically my script does not delete folders older than two days, it just keeps the two newest folders that match your date pattern. If you create a new folder every day for some type of backup this will essentially keep the two newest folders.
by Squashman
27 Dec 2011 06:37
Forum: DOS Batch Forum
Topic: delete 2 days older folders
Replies: 18
Views: 6092

Re: delete 2 days older folders

A batch file using the ForFiles command in combination with the findstr command may work better but ForFiles is not native to Windows XP. Going to throw my idea out there but I am sure other suggestions may come along that will work better as my script may have some caveats because I don't know how ...
by Squashman
26 Dec 2011 21:41
Forum: DOS Batch Forum
Topic: The final decider-Linux/Unix or Windows
Replies: 8
Views: 3671

Re: The final decider-Linux/Unix or Windows

One reason I joined this forum just a few days ago was because it is batch centric. I thought I knew a lot about batch scripting when I joined but now I am blown away by some of the tricks people do to get things done with batch scripts. I learn something new here every time I visit. I used to do a ...
by Squashman
24 Dec 2011 22:12
Forum: DOS Batch Forum
Topic: Piped input and output to a batch file
Replies: 18
Views: 8757

Re: Piped input and output to a batch file

That is pretty cool
by Squashman
24 Dec 2011 14:34
Forum: DOS Batch Forum
Topic: Can I get individual "unix" lines read by set /P "LN="
Replies: 4
Views: 1619

Re: Can I get individual "unix" lines read by set /P "LN="

Other option would be to run a UNIX2DOS command on the input file first. I have Win32 versions of several Unix commands on my pc just for situations like this. I knew about the set /p limitation with LF terminated text files. I have a batch file where I pull the first record from each file into anot...
by Squashman
23 Dec 2011 14:35
Forum: DOS Batch Forum
Topic: Piped input and output to a batch file
Replies: 18
Views: 8757

Re: Piped input and output to a batch file

Not understanding how you feel my response was incorrect.
You are not going to be able to use a PIPE to get the desired result he wants unless he would use something like SED or AWK. You would have to use a FOR Loop which is what I provided.
by Squashman
23 Dec 2011 14:06
Forum: DOS Batch Forum
Topic: Piped input and output to a batch file
Replies: 18
Views: 8757

Re: Piped input and output to a batch file

You are not going to be able to do that without some type of stream editor like SED. They do make ports of it for Win32. But your examples shows that you want to do this from the output of the DIR command which is easy enough with a FOR LOOP. @echo off SETLOCAL set prefix=%~1 set suffix=%~2 FOR /F &...