Help modifying script to loop through all folders

I have this script someone very kindly help me write last year which loops through all files in a folder and does a command.

I need to modify it to loop through all sub-folders of a main folder and only perform the command on files modified after Jan 1st 2008. And I need the command to place the new created files in a new sub folder.

Here is the original script:

#!/bin/sh

for file in *
do
    newname="$file".txt
    expage "$file" >"$newname"
    echo "Expaged $file to $newname"
done

Come to think of it, all I need the script to do is copy all the files that were modified after Jan 1, 2008 to a new folder.

Not very clear if you resolved the problem, but from your first request you can try the following,

#!/bin/sh

cd /path/to/main_folder
mkdir new_subfolder

find . -type f -mtime -265 | while read file
 do
    newname="$file".txt
    expage "$file" >"$newname"
    echo "Expaged $file to $newname"
    cp -p "$newname" new_subfolder/
    # mv "$newname" new_subfolder/
 done

Change the no. of days ( 265 ) to whatever number you need.

You don't really need a number.

find . -type f -atime -"$(($(date "+%j" ) - 1 ))" | while read file
...