How to? Move files older than one year

Apr 21, 2013
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
 
May 20, 2008
11,401
99
Syracuse, NY, USA
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
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
4,461
88
Albuquerque, NM
prospero.unm.edu
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?
 
May 20, 2008
11,401
99
Syracuse, NY, USA
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
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
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.)
 
Apr 21, 2013
4
0
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.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
@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
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.
 
Aug 2, 2011
258
4
Berlin, Germany
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
Thread starter Title Forum Replies Date
G Fixed MOVE truncates files Support 9
thedave Move files, inherit permissions Support 14
D Move /v to DVD fails but files identical Support 4
S Conditionally MOVE/COPY files on the basis of size Support 1
C question re: Move Support 3
samintz MOVE and Prompt on overwrite Support 3
M MOVE does not behaves like intended (on failure) Support 1
kb6ojs Make /G parameter persistent in COPY/MOVE command? Support 4
F Regexes in REN/MOVE/… commands seem to not work at all Support 3
T How to? Off screen move? Support 3
fpefpe Documentation copy/move using /c or /u Support 2
W Recursive move aborts early Support 2
C b21 MOVE /B Support 8
D How move cursor out of popup edit control after no match? Support 14
nickles Move takecommand.18.0.key location to installation directory Support 4
J junction copy/move handling Support 6
J WAD move /s regression from tcc15 Support 5
C move /F Support 4
vefatica MOVE anomaly Support 8
C Move /s sorce target Support 13
Stefano Piccardi b32 move /Q writes message Support 1
C How to? MOVE and handling out of space Support 2
Joe Caverly How to? Move Window Between Monitors Support 6
fpefpe move /g Support 4
C Move /MD not always working Support 1
C Move question with Encrypted file... Support 6
W /g option (%) on MOVE cmd appears broken TCC 14.03.57 x64 Support 8
C MOVE making empty destinatation sub-folders Support 10
A Discrepancy in handling of "can't copy or move file to itself" Support 4
A expected behavior of move /sx Support 14
S MOVE from FTP directory to another FTP directory - bug?? Support 2
J directory tree - move or copy Support 3
D MOVE Help typo Support 3
D Suggest Help mention /n no effect in move /n Dir1 Dir2 Support 0
S MOVE to different drive Support 3
Joe Caverly Move Buttons Between Tabbed Toolbars Support 2
S Another 4NT 8.02 vs TCC 9.02 diff - MOVE command Support 3
S MOVE command over FTP with 4NT 5.00U Support 0
D Bug Can't delete empty temporary files. Support 2
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
fpefpe How to? shortcuts and batch files Support 4
C v28 key files Support 2
J ffind does not find files Support 4
C duplicate files in multiple plugin sites Support 9
Dmitry L. Kobyakov Fixed The SETARRAY /R command works incorrectly with cyrillic files Support 2
S How to? Deinstalling TC/reinstating execution of bat files by cmd in Win7 Support 31
vefatica FFIND, temp files? ... not deleted? Support 0
R FUNCTION to count NUMBER of files matching a pattern and specific length/not length Support 4
vefatica Tmp files from in-process pipes not deleted Support 6
vefatica Finding files with alternate data streams? Support 4

Similar threads