I write batch file and i want to compare the modification time (timstap) to two folder and copy the latest one . i don't know if this option available directory be cause i don't know .so i want to get the date and store each part in variale to compare it
Example :-
get date date
11 5 2011 11:10:57
day=11
month=5
year=2011
hour=11
min=10
secnd=57
Bash provides the
-nt
comparison operator which returns true if one file is newer than another file. Here's a script which illustrates this functionalityMaybe the option -newer of "find" can do it.
find . -newer directory -exec cp {} /new/location \;
P.D. I don't speak english
To set datetime components to shell variables:
To compare dates, Iain's answer is the way to go.