download latest folder

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
guest22

download latest folder

Post by guest22 » Wed Jan 22, 2003 8:09 pm

Anyone know if this would be possible:

Go to a website and check a directory then download the contents of a folder with the latest date. So in the following example it would look in a given directory with the following folders and find the latest folder (in this case Folder C) and download it's contents or the folder itself:

Folder A......01-Jan-2003
Folder B......02-Jan-2003
Folder C......03-Jan-2003

So the next day it could be:

Folder A......01-Jan-2003
Folder B......02-Jan-2003
Folder C......03-Jan-2003
Folder D......04-Jan-2003

and it would then download Folder D. Perhaps this isn't the right tool to use but I couldn't find a download manager/scheduler that would do this. Any help would be appreciated.

Guest

Post by Guest » Wed Jan 22, 2003 9:25 pm

Hi,

Code: Select all

Run Program>cmd /k dir /B /O-D /A:D C:\Temp\*.* > C:\CDrive.txt
ReadLN>C:\CDrive.txt,1,Folder2Copy
CopyFiles>%Folder2Copy%\*.*,D:\%Folder2Copy%\*.*
cmd=NT,W2K,XP
command=W9x,Me

:)

guest22

Post by guest22 » Wed Jan 22, 2003 10:28 pm

Thanks for the assist!!

Here are the small change I made to test (test4 contains 2 folders with files and test5 is an empty folder)

Run Program>cmd /k dir /B /O-D /A:D C:\test4\*.* > C:\CDrive.txt
ReadLN>C:\CDrive.txt,1,Folder2Copy
CopyFile>%Folder2Copy%\*.*,C:\test5\%Folder2Copy%\*.*

under 98 (after changing it to "command") I get:

Error Executing command /k dir /B /O-D /A:D C:\test4\*.* > C:\CDrive.txt (2)


under XP I get:

The CDrive.txt file gets created, a command prompt window pops up and that's it. No files are copied.

I can run "cmd /k dir /B /O-D /A:D C:\test4\*.* > C:\CDrive.txt " just fine outside in both cases. I'm probably doing something silly but I just can't see it :)

guest22

Post by guest22 » Wed Jan 22, 2003 10:29 pm

oops forgot to wrap

Guest

Post by Guest » Thu Jan 23, 2003 6:34 pm

Hi,
have a try with "xcopy" instead of the Copy File> command.

Code: Select all

Let>source=C:\test4
Let>destination=C:\test5

Run Program>cmd /k dir /B /O-D /A %source%\*.* > C:\CDrive.txt
ReadLN>C:\CDrive.txt,1,Folder2Copy
Run Program>cmd /k xcopy %source%\%Folder2Copy% %destination% /S
BTW: If you change the parameter /k to /c after testing, the DOSBox will disappear after the task has finished.

more info on xcopy:cmd /k xcopy /?

guest22

Post by guest22 » Fri Jan 24, 2003 4:54 pm

Yeah, that's what I ended up using.

Also the DeleteFile command doesn't seem to work all the time (didn't work under schedule but worked when I tested it). I ended up replacing that with the DOS equivalent as well.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts