Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to know what this does?

Status
Not open for further replies.

cdulong

Technical User
Nov 18, 2008
80
CA
I found a batch file online that is programmed to delete files in a folder older than 3 days. The problem I am having is there is a line I am not 100% about.

dir /b /a-d 2^>NUL

I do understand that this commnand will output the contents of a folder with only file name and no header or footer. What I do not understand is the last part of the command 2^>NUL. When I run the command without the last part it displays the files in a folder. When I run the command with the last part I recieve an error 'File not Found'.

Any help would be great.

Thanks,
cdulong
 
Best to post the whole script so people can follow it through it's entirety.
 
I'm not convinced that line is correct though.

Basically all its doing is executing the dir command but getting rid of the output by sending it into the NUL device.

I'm not sure that would produce anything relevant in any script.

Unless the he actually expected the error for something.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Yeah, you can download lots of scripts off the internet. Some are incorrect, some are correct and some are trying to do something to you that you may not want.

So, unless you completely understand how it works/what it does, it may not be a good idea to test on an important system.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top