Good afternoon, Pessal,
I need to move folder files but from a modification date, but the date is not being used in the command. Where am I going wrong?
Follow the code
@echo off
CD C:\USERS\FOLDER1
XCOPY /D:04-26-2017 C:\USERS\FOLDER1\*.txt C:\USERS\FOLDER2\
echo Files copied
echo
forfiles /D 27/04/2017 /s /m "*.txt" /c "cmd /c echo @file "
forfiles /D 27/04/2017 /s /m "*.txt" /c "cmd /c del @file "
echo files deleted
pause
xcopy date format
Moderator: DosItHelp
Re: xcopy date format
On a first look it seems that the xcopy command should be alright.
What error and error message do you get?
Beside this, i suspect the forfiles date format to be wrong, because i haven't seen slash '/' as delimter and the order day, month, year at the same time:
You should use the same date format as used by the "date" environment variable.
Sidenote: Please use code tags ([code][/code]) around your code instead of colorizing it blue ([color=#0000BF][/color]).
The code block has the advantage that you can use the "mark all" functionality instead of marking all code text manually.
penpen
What error and error message do you get?
Beside this, i suspect the forfiles date format to be wrong, because i haven't seen slash '/' as delimter and the order day, month, year at the same time:
You should use the same date format as used by the "date" environment variable.
Sidenote: Please use code tags ([code][/code]) around your code instead of colorizing it blue ([color=#0000BF][/color]).
The code block has the advantage that you can use the "mark all" functionality instead of marking all code text manually.
penpen