topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday December 16, 2024, 1:12 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: SOLVED: directory tree 'crawler'  (Read 5469 times)

Pattern-chaser

  • Participant
  • Joined in 2011
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
SOLVED: directory tree 'crawler'
« on: March 07, 2011, 05:41 AM »
My request is for a utility that will execute a given command in the starting directory, and also in all sub-directories in that directory. A very simple example of usage:

Crawler "C:\Code" "Dir *.c"

Will list all C source code files in C:\Code, and in all sub-directories. This example isn't even necessary, as "Dir" will do it for you, but you can see how useful it could be when you use a more meaningful command.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member

Pattern-chaser

  • Participant
  • Joined in 2011
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: IDEA: directory tree 'crawler'
« Reply #2 on: March 07, 2011, 07:53 AM »
Even better than having it written for me: a pointer to where someone already did it! Thanks Skwire!

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: IDEA: directory tree 'crawler'
« Reply #3 on: March 07, 2011, 07:56 AM »
You're welcome.   :)

capitalH

  • Participant
  • Joined in 2008
  • *
  • Posts: 71
    • View Profile
    • Donate to Member
Re: SOLVED: directory tree 'crawler'
« Reply #4 on: March 08, 2011, 03:29 AM »
or save a batch file with the following content

c:
cd C:\Code
for /f "tokens=*" %%d in ('dir /ad/b/s') do dir "%%d\*.c"
The first two lines is just to ensure you are in the right subdirectory
replace
dir "%%d\*.c"
with the command of your choosing (keeping the %%d though - which is each directory - try running with echo dir "%%d\*.c" to see what the actual command will be that will be run - without doing something weird to your system!)

No download, portable (windows only though) small filesize and no malware.