General discussion

Locked

I need a Script

By k_hall ·
I need a simple script that will move files from one location to another. Except I only want to move the files that haven't been modified in 14 days or more.

This conversation is currently closed to new comments.

10 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by BFilmFan In reply to I need a Script

DateTree can do that for about $6.99.

Check here for details:

http://www.orange-carb.org/DateTree/manual.html

Collapse -

by k_hall In reply to

I think I should be able to do this for free.

Collapse -

by Gary_W In reply to I need a Script

Put this code into a file named moveme and make it executable. Usage: moveme fromdir todir

find $1 -mtime +14 -exec mv {} $2 \;


Gary

Collapse -

by Gary_W In reply to

P.S. This is if you are on a *nix box.

Collapse -

by k_hall In reply to

I am just trying to create a routine to move files off of our FTP server than are older than 2 weeks old. Instead of deleteing I just want to move them to my PC. I would like the routine to run once a week from my Windows XP Pro machine.

Collapse -

by Toivo Talikka In reply to I need a Script

You can do a lot with the available command level scripts in Windows XP. The following is quite crude and it may not be exactly what you want but if you can schedule the maintenance jobs to run at a time when your FTP server does not have much activity, it might suffice. Otherwise, you could look at the scripting support on the server itself, or a small VB or VBA program on XP.

The script uses two directories in your PC, \ftpbak (auxiliary directory, contains files modified recently) and \ftpfiles (contains all the files from the FTP directory, including the recent ones).

The script assumes that you have a mapped drive K: pointing to your FTP server directory. Create the following script and call it ftpcopy.cmd:


CD \
RMDIR ftpbak /s /q
MKDIR ftpbak
CD \ftpbak
XCOPY K:\*.* /d:8-17-2005 /e /q /c /y
CD \ftpfiles
XCOPY K:\*.* /e /q /c /y
DEL K:\*.* /q /s
CD \ftpbak
XCOPY *.* K.

You can modify the date in the script manually, or replace the parameter /d:m-d-y with /d:%1 and call the script with the date as the input parameter:

ftpcopy 8-17-2005

You can also set up a scheduled task pointing to the script ftpcopy.cmd and get the job to start for example at 2AM on a particular day. Remember to go to the Properties of the scheduled task and add the date to the Run field of the job:

C:\mydirectory\ftpcopy.cmd 7-1-2005

Enjoy!

Collapse -

by k_hall In reply to

Poster rated this answer.

Collapse -

by YetAnotherAdmin In reply to I need a Script

Robocopy.exe http://www.ss64.com/nt/robocopy.html will do all this and more. For a gui that will write the scripts for you try http://www.gotdotnet.com/workspaces/releases/viewuploads.aspx?id=108f89b9-be0b-4ec4-9736-3a43d39f0146

Collapse -

by k_hall In reply to

Poster rated this answer.

Collapse -

by k_hall In reply to I need a Script

This question was closed by the author

Back to Web Development Forum
10 total posts (Page 1 of 1)  

Related Discussions

Related Forums