Daar moet je mee oppassen.. Als de output van de dir te groot wordt, wil die nog wel eens over de zeik gaan. Daarbij krijg ik bij jou scriptje wel een erg rare ouput; hij verslikt zich als er directories in staan.
Beter is om gewoon de FOR statement voor het geheel van zoeken te gebruiken.
code:
1
| For /r C:\ %%x in (*.Doc) do If %%~zx GTR 1048576 echo %%x |
De 'C:\' is de start directory en die doorloopt ie recursief. De '1048576' is de 1MB in bytes uitgedrukt. %%~zx heeft als inhoud de filesize in bytes.
Wil je een echte output met datum en tijd ed dan kun je in de echo statement nog wat extra's toevoegen.
In addition, substitution of FOR variable references has been enhanced.
You can now use the following optional syntax:
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~dI - expands %I to a drive letter only
%~pI - expands %I to a path only
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
%~sI - expanded path contains short names only
%~aI - expands %I to file attributes of file
%~tI - expands %I to date/time of file
%~zI - expands %I to size of file
%~$PATH:I - searches the directories listed in the PATH
environment variable and expands %I to the
fully qualified name of the first one found.
If the environment variable name is not
defined or the file is not found by the
search, then this modifier expands to the
empty string
Even een quote uit de help van de for. In dit voorbeeld is I de variable, in het voorbeeldje van mij is x de variable.
Je kan het ook combineren dus. %%~zx is voor de size, %%~tx is de datum/tijd. %%~ztx geeft size en datum en tijd.
[
Voor 59% gewijzigd door
Krypt op 27-10-2005 15:11
]