Possible Duplicate:
Windows batch (files)
Hello . I am trying to do a batch script that prints for each filename from the command line all subfolders of the folder, where the file is found (I have as parameters a folder and a list of filenames). The subfolder names should be sorted in descending order of the file sizes (the file can have various sizes in different subfolders). I can't find a script that prints the paths. Can anyone help?
@echo off
REM check the numbers of parameters
if "%2"=="" goto err1
REM check: is first parameter a directory?
if NOT EXIST %1\NUL goto err2
set d=%1
shift
REM iterate the rest of the parametersa
for %%i in %dir% (
find %dir /name %i > temp
if EXIST du /b temp | cut /f 1 goto err3
myvar=TYPE temp
echo "file " %i "is in: "
for %%j in %myvar do
echo %j
echo after sort
du /b %myvar | sort /nr
)
:err1
echo Two parameters are necessary
goto end
:err2
echo First parameter must be a directory.
:err3
echo file does not exist.
:end