Reputation: 107
i have a directoy structure thus
C:folder\
\davis\Myfiles\saved
\brown\Myfiles\saved
\smith\Myfiles\saved
\jones\Myfiles\saved
what i want to achive is this
for each directory called 'Myfiles'
IF NOT Exists 'Myfiles\*doc.rtf'
copy files caled 'Myfiles\*doc.txt' to the subdirectory 'Myfiles\saved'
move files called 'Myfiles\*doc.txt' to 'somewhereElse'
But how do i do this with a batch
Upvotes: 2
Views: 351
Reputation: 29339
Read HELP FOR
and try this code that may help you get started...
for /r /d %%a in (*) do (
if /i %%~na==myfiles (
pushd %%a
for %%b in (*doc.txt) do (
if not exist %%~nb.rtf (
echo copy %%b saved
echo move %%b \somehwereelse
)
)
popd
)
)
Upvotes: 1