Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Move files older than one year

Apr
4
0
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
 
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%
 
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 :-(
 
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?
 
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
 
Incidentally, I'm curious where that -10000 comes from. Ten thousand days is a bit over 27 years; 10000 days ago is after the FAT epoch. (And way after the NTFS epoch.)
 
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.
 
@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].
 
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.
 
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:
 

Similar threads

Back
Top