Is it possible to use Command Prompt to locate a file in the directory that contains the word "main" in its name and then push that file onto an Android device?

This is what I have so far -

pushd \\nm\games\BeaverGames\Mobile\Custom Street Racer\Builds\GooglePlay 
for /f "delims=" %a in ('dir /b /a:d *2015*') do cd %a
for /f "delims=" %a in ('dir /b /a:d *10*') do cd %a
for /f "delims=" %a in ('dir /b /a:d *prod*') do cd %a
adb push csr.apk /sdcard/.
adb shell mkdir /sdcard/Android/obb/com.naturalmotion.csrracing

This gets me to a point where I have 2 files in a folder that I need to push onto an Android device, one called main 1001 and one called patch 1001. Now the numbers in the file name always change but the word "main" and "patch" do not. So is it possible to search for just the word "main" and then push it onto the device?

  • It is possible but you will need to show effort was shown in your question before anyone helps you. Nobody will want to do all of the work for you. – Eric F Jan 22 '15 at 14:48
  • I don't even know what your asking. – Ramhound Jan 22 '15 at 14:51
  • ah ok thanks for the heads up. I have tried loads of things and they are most probably all wrong. But I will post them anyways. – Luke Jan 22 '15 at 14:52
  • Sorry if it is unclear. I have updated my question hope it helps – Luke Jan 22 '15 at 15:02
  • Take a look here: stackoverflow.com/questions/2010253/… – Eric F Jan 22 '15 at 15:05

Maybe you are looking for a .bat script which browses your partial folder structure:

pushd \\nm\games\BeaverGames\Mobile\Custom Street Racer\Builds\GooglePlay 

for /f "tokens=* delims=" %%G in ('dir /b /a:d *2015*') do (
  pushd %%~fG
  echo folder G %%~fG

  for /f "tokens=* delims=" %%H in ('dir /b /a:d *10*') do (
    pushd %%~fH
    echo folder H %%~fH

    for /f "tokens=* delims=" %%I in ('dir /b /a:d *prod*') do (
      pushd %%~fI
      echo folder I %%~fI

      for /f "tokens=* delims=" %%J in ('dir /b /a:-d *main*') do (
        echo file J %%~fJ


goto :eof

In place of (or next to) each echo folder ... (echo file ...) there could be a good position for next actions...

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.