1.

Solve : Archive Files?

Answer»

I am trying to write a script that will do the following:

1. Test for an archive directory, and create it if it doesn't exist.
2. Move files older than 30 days from an input directory to the archive directory.

Below is the code I have so far. The last line is causing errors which are listed below the code. I will be running this on WINDOWS XP and eventually it will be MOVED to a Server 2003 machine.

Code: [Select]
@ECHO off
setlocal enabledelayedexpansion

set currentdirectory=C:\DocumentQC\Input-Delete
set backupdirectory=C:\DocumentQC\backupdir

IF EXIST %backupdirectory% GOTO MOVE_FILES
MD %backupdirectory%
:MOVE_FILES
FOR /f -p%currentdirectory% -s -m*.* -d-30 -c"CMD /C MOVE /y @FILE %backupdirectory%"


----------------- ERROR -----------------------

-s was UNEXPECTED at this time.

----------------- ERROR -----------------------

I'm obviously using FOR and MOVE incorrectly, any advice would be appreciated. Thanks.Look at for /? And you should see why it isn't working.



Discussion

No Comment Found