Shell scripting to the rescue
This looks like a perfect chance to learn the wonderful world of shell scripting.
Don't worry, you're gonna hate it at the beginning, but after a while, you will hardly be able to live without it. So, for starters, install cygwin, give yourself a nice full install, because getting components later is typically a pain. One caution, it's gonna take the better part of the day to download and install, it's pretty huge.
[taps fingers on desk while cygwin installs]
Now you have a wonderful unix-ish environment, which will almost work as well as a linux command line... almost. Since I guess you are probably new at this, I'm gonna try and take it a bit slowly, so you can actually (maybe, if I explain it well enough) learn what is going on and it won't be quite so much magic. Any line with a pound sign in front of it means you should type it in with the cygwin BASH shell. Beware, I might do something malicious so be sure you know what these things are doing before you do them, and at least make a backup.
First off, lets get a file list of all of the new files (in the last two days):
# cd c:/blah/blah/blah/
# find . -ctime 2 -type f
Hopefully that gives you the list of what you want, and I will assume that it spits out a lot of junk that looks like this:
./site_a/file1.html
Well, that is half the problem, finding all of the new files, but you could have done that with a simple "Find..." command. Now for the hard part, uploading them to the new directories with new filenames!
Well, we want the filenames to be stored, so we can go through them one by one, so here we go:
# FILELIST=`find . -ctime 2 -type f`
Now we got that list of files, and threw it into $FILELIST, yay. What do you say we list what is in $FILELIST
This will be typed in a little differently, because after the first line, it will prompt you for the other lines until you give it the 'done' command.
# for $FILELIST in FILE do
> echo "Looking at file $FILE"
> done
Okay, look at the output from that, if that looks good, then do this next one:
# for $FILELIST in FILE do
> echo "Uploading $FILE"
> ncftpput -u myuser -p mypassword ftpsite /reports/$FILE
> done
That should do it. I'll leave it up to you to tweak it to what you really need, and to put it in to a file so it's easy for you to run.
|