Script for Automatically moving files older than 'X' days
Moderator: DosItHelp
-
- Posts: 2
- Joined: 22 Aug 2014 14:20
Script for Automatically moving files older than 'X' days
Hello,
I am looking for a DOS script for automatically moving files which are older than 'X' number of days. My platform is Windows 7.
Thanks in advance.
I am looking for a DOS script for automatically moving files which are older than 'X' number of days. My platform is Windows 7.
Thanks in advance.
Re: Script for Automatically moving files older than 'X' day
forfiles.exe can help you there.
Ask specific questions if you have trouble with it.
Ask specific questions if you have trouble with it.
Re: Script for Automatically moving files older than 'X' day
Code: Select all
@echo off
set X=30
set "source=C:\Work"
set "destination=D:\Archive"
robocopy "%source%" "%destination%" /mov /minage:%X%
exit /b
Re: Script for Automatically moving files older than 'X' day
That's a good solution Yury.
Re: Script for Automatically moving files older than 'X' day
Yury wrote:Code: Select all
@echo off
set X=30
set "source=C:\Work"
set "destination=D:\Archive"
robocopy "%source%" "%destination%" /mov /minage:%X%
exit /b
hi Yuri,
my netbook has changed from window 7 to XP
what is equivalent of ROBOCOPY in window xp sp3 ?
or can you give me scripts like above for use in window xp sp3 ?
thanks.
Bars
Re: Script for Automatically moving files older than 'X' day
Use robocopy from the Windows 2003 resource kit
-
- Expert
- Posts: 1163
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Script for Automatically moving files older than 'X' day
Squashman wrote:Use robocopy from the Windows 2003 resource kit
Maybe he's working for a company whose User Access Policy doesn't allow him to install programs. Maybe he needs the program to work on multiple Windows XP computers with unknown configurations. Pure batch > using other programs.
-
- Posts: 239
- Joined: 04 Mar 2014 11:14
- Location: germany
Re: Script for Automatically moving files older than 'X' day
For use the robocopy.exe it does not requirement to install on System.
Into variable PATH add the path from downloaded robocopy.exe.
Phil
Into variable PATH add the path from downloaded robocopy.exe.
Phil
-
- Expert
- Posts: 1163
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Script for Automatically moving files older than 'X' day
pieh-ejdsch wrote:For use the robocopy.exe it does not requirement to install on System.
Into variable PATH add the path from downloaded robocopy.exe.
Phil
It still doesn't come with the system normally and has to be downloaded. Some places have a policy against that as well.
-
- Expert
- Posts: 941
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: Script for Automatically moving files older than 'X' day
It's possible use xcopy + move?
Re: Script for Automatically moving files older than 'X' day
ShadowThief wrote:Some places have a policy against that as well.
That's true ShadowThief, though they need to state that limitation when asking for help, as they are already aware of it.
-
- Expert
- Posts: 1163
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Script for Automatically moving files older than 'X' day
foxidrive wrote:ShadowThief wrote:Some places have a policy against that as well.
That's true ShadowThief, though they need to state that limitation when asking for help, as they are already aware of it.
I totally agree, but people have a tendency to skip over vital information in their first post, especially if they're new to forums. Also, I'm also thinking of the people months from now who find this thread in a Google search and need a pure batch response.
Re: Script for Automatically moving files older than 'X' day
ShadowThief wrote: find this thread in a Google search and need a pure batch response.
Purely in the spirit of discussion, I think fewer people will use XP as the time passes and every machine will have robocopy installed by virtue of it being a default tool in Vista and later.
It is possible that a pure batch solution for this task will be difficult to do in a robust way, that is not tied to language and regional settings.
Forfiles.exe is another tool that can be used - it also needs to be downloaded for XP.
-
- Expert
- Posts: 1163
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Script for Automatically moving files older than 'X' day
foxidrive wrote:ShadowThief wrote: find this thread in a Google search and need a pure batch response.
Purely in the spirit of discussion, I think fewer people will use XP as the time passes and every machine will have robocopy installed by virtue of it being a default tool in Vista and later.
It is possible that a pure batch solution for this task will be difficult to do in a robust way, that is not tied to language and regional settings.
Forfiles.exe is another tool that can be used - it also needs to be downloaded for XP.
Very true. After a little investigation, it would appear that my concerns were unfounded, as Googling a way to move files older than X days via xcopy will show this stackoverflow answer by dbenham: http://stackoverflow.com/a/8905993
Re: Script for Automatically moving files older than 'X' day
Bewdy.
I think the OP has disappeared...
I think the OP has disappeared...