How to? Move files older than one year

Apr 21, 2013
4
0
#1
Hello,
I would like to make a script to archive files older than one year in a specific archive area.

The copy command knows the /[d...] parameter, so with this command
copy %source%\*.* %destination% /[d-365,-10000] /s
it works well, but the "move" command doesn't know this syntax.

So is there a solution to do it with the move command?

NB. Sorry for my poor English
 
#2
According to the help, MOVE does support date ranges (/[d...) and directory trees (/s). Did you try putting the options **before** the source/destination (where they belong)?
Code:
move /[d-365,-10000] /s %source%\*.* %destination%
 
Apr 21, 2013
4
0
#3
not, unfortunately, the move command does not support this parameter, unlike the copy command
I also tried using the command "forfiles" like
forfiles / pz: \ temp / s / d -250 / c "cmd / c move / y @ path z: \ 250" but i loose the directories structures :-(
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,599
46
Albuquerque, NM
prospero.unm.edu
#4
not, unfortunately, the move command does not support this parameter, unlike the copy command
TCC's internal MOVE command certainly does support date ranges. Is it possible that you have it aliased, or the internal command disabled? What does WHICH MOVE report?

What is the exact command you are typing, and what are the values of the variables? What is the exact error message you get?
 
#5
As Charles said, it does work. I am confident that below, if I removed the "/n" the files would be moved.

Code:
v:\> move /n /[d-365,-10000] /s v:\* k:\
V:\addrule.txt -> K:\addrule.txt
V:\anagram.exe -> K:\anagram.exe
[snip]
V:\test\whois.btm -> K:\test\whois.btm
V:\test\wmiuptime.btm -> K:\test\wmiuptime.btm
  966 files would be moved
 
Apr 21, 2013
4
0
#7
ohhh, thanx for all you answers. the move command works well but the problem was somewhere else.

In my script, i used the /f parameter with "copy" and it was this one which is not compatible between the copy and the move command :-(
So sorry for this stupid question of me.

@Charles Dye: i uses the -10000 for un exemple, because i wanted to be sure that my range date will get all files older than 365 days until the begining.
 
#8
@Charles Dye: i uses the -10000 for un exemple, because i wanted to be sure that my range date will get all files older than 365 days until the begining.
Incidentally, for dates/times/sizes, you can create an "excluded ... range" thus: /![...]. To exclude files dated today, use either /![d] or /![d-0]. To exclude files dated today or the previous 365 days use /![d-365].
 
Apr 21, 2013
4
0
#9
great command and so easy :-)
thanx ;)
This tips help me to discover some files dated of 00:00:00:00.
In addition, the /e parameters is also very usefull because in one opération, if all files in a directory are older than 365 days, the folder itself is removed.
 
#10
Incidentally, for dates/times/sizes, you can create an "excluded ... range" thus: /![...]. To exclude files dated today, use either /![d] or /![d-0]. To exclude files dated today or the previous 365 days use /![d-365].
Steve, this is a very helpful example for me! Never came in my mind :oops: