Search found 4314 matches

by Squashman
27 Dec 2011 11:57
Forum: DOS Batch Forum
Topic: delete 2 days older folders
Replies: 18
Views: 16881

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: 16881

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: 16881

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: 16881

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: 9432

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: 21930

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: 4607

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: 21930

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: 21930

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 &...