xcopy date format

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
andregomesvs
Posts: 1
Joined: 27 Apr 2017 09:03

xcopy date format

#1 Post by andregomesvs » 27 Apr 2017 09:53

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

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: xcopy date format

#2 Post by penpen » 27 Apr 2017 16:37

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

Post Reply