Wowbagger said:
I ran this from the prompt, changing "%%" to "%" and changing
"\newfoldername\*.*" to "pictest\*.*" and got several hundred lines of:
if GTR 150000 ECHO "X:\RE"
if GTR 150000 ECHO "X:\RE"
if GTR 150000 ECHO "X:\RE"
if GTR 150000 ECHO "X:\RE"
if GTR 150000 ECHO "X:\RE"
("x:\re dir" is the network directory in which pictest resides)
Aha!
that little parenthetic note is the key...
try
@echo off
for /f "DELIMS=" %%i in ('dir /S/b/a-d "x:\re dir\pictest\*.*" ') do if
%%~zi GTR 150000 ECHO "%%i"
(which should list the filenames ONLY of files >150000 bytes)
and hence
@echo off
for /f "DELIMS=" %%i in ('dir /S/b/a-d %*\*.*') do if %%~zi GTR 150000 ECHO
"%%i"
pause
where %* is the entire command-tail (which I presumed to be a
directoryname.)
Naturally, you could replace the *.* with *.jpg (or whatever) to restrict
the filenames examined to just .jpg files, for instance. Or, if you wish,
simply specify a fixed full path, if that is your objective)
which you may develop to
[1]@echo off
[2]MD "destinationfoldername" 2>nul
[3]for /f "DELIMS=" %%i in ('dir /S/b/a-d %*\*.*') do if %%~zi GTR 150000
MOVE "%%i" "destinationfoldername"
to force the creation of the destinationfolder and then move the files.
(note lines begin [number]. Lines will be wrapped. You need to rejoin the
lines and remove the leading [number] to use the batch.)
===
%%i selects the first TOKEN in the line produced by the DIR.... command,
which would have the format
X:\RE dir\pictest\file1.jpg
X:\RE dir\pictest\file2.jpg ...
Note that if your current directory is [X:\RE dir] then specifying
[pictest\*.*] as your filemask actually examines [X:\RE dir\pictest\*.*] (or
[.\pictest\*.*]) - the directoryname is relative to the current directory.
inserting the ["delims="] overrides the default delimiters (which include
SPACE) with (no delimiters) [the character(s) between the [=] and the ["]
hence the entire line rather than the first token (X:\RE) will be selected
as %%i.
With %%i set to [X:\RE], %%~zi (the size of X:\RE) has no value as X:\RE is
not a file, and the command is resolved to IF GTR 150000.... since the value
of %%i is []
[] used to delimit elements in the discussion since single and double-quotes
have significance to batch.
HTH
....Bill