Jump to content

Archiving files that haven't been accessed in 2 years


Recommended Posts

Posted
I have noticed that the server space on our Windows network is getting very low. So I have agreed with SLT to have a look to see if I can archive off files that haven't been accessed in over 2 years. Is it possible to write a script (maybe using Robocopy?) that will scan for files that haven't been accessed in 2 years, output the names and file paths to a text file, copy these files to an external hard drive and then delete them from the network?
  • Thanks 2
Posted

I have that exact script!

 

robocopy.exe "F:\Share" "F:\Data\_ArchiveShare" *.* /S /COPY:DATSO /MOVE /ZB /NP /XA:RHS /XF *.ini *.ico /MINAGE:730 /R:2 /W:10

pause

 

Run on the file server, altering the path names obviously.

  • Thanks 4
Posted (edited)

Be careful, you're selecting file on their creation date, not the last access date.

 

Robocopy can do this, use the MINLAD option.

 

/MAXLAD:n : MAXimum Last Access Date - exclude files unused since n.

/MINLAD:n : MINimum Last Access Date - exclude files used since n.

(If n < 1900 then n = n days, else n = YYYYMMDD date).

 

When testing, you'll want to use the /L option

/L : List only - don’t copy, timestamp or delete any files.

 

 

http://ss64.com/nt/robocopy.html

Edited by jinnantonnixx
  • Thanks 4
Posted
Is there anyway I can get the file paths and file names to display to a TXT file?

 

Plenty of options...

 

You'll probably want /L with /LOG:logfile

 

Logging options

/L : List only - don’t copy, timestamp or delete any files.

/NP : No Progress - don’t display % copied.

/LOG:file : Output status to LOG file (overwrite existing log).

/UNILOG:file : Output status to Unicode Log file (overwrite) ##

/LOG+:file : Output status to LOG file (append to existing log).

/UNILOG+:file : Output status to Unicode Log file (append) ##

/TS : Include Source file Time Stamps in the output.

/FP : Include Full Pathname of files in the output.

/NS : No Size - don’t log file sizes.

/NC : No Class - don’t log file classes.

/NFL : No File List - don’t log file names.

/NDL : No Directory List - don’t log directory names.

/TEE : Output to console window, as well as the log file.

/NJH : No Job Header.

/NJS : No Job Summary.

  • Thanks 1
Posted
I wanted to do this on our file server for anything not accessed in the last 5 years and was told that everything on there was essential :-(

 

If you're getting this thrown back at you, you need to work out the costs of archiving vs online storage (I assume a SAN) per Mb. Then work out how much your growth rate is. Then work out how many you could potentially move to archive. Armed with this info you can go back say, "OK based on your decision I'll need £XXXX for a new san in Y years, unless you let me archive at rentintion time Z years in which case we can avoid spending that money for A years."

  • Thanks 1
Posted
I wanted to do this on our file server for anything not accessed in the last 5 years and was told that everything on there was essential :-(

 

So do it and if they complain restore from archive. If they don't notice it wasn't essential.

 

Essential doesn't mean have to have it at my fingertips 24/7, just not deleted.

Posted

So, I'm presuming that this is the script I need:

 

robocopy.exe “” “” *.* /S /E /COPY:DATSO /MOVE /ZB /MINLAD:730 /R:2 /W:10

 

Notice the MINLAD - I think this is correct (/MINLAD:n : MINimum Last Access Date - exclude files used since n) So, in this case, /MINLAD:730 - Exclude files used in the last 730 days.

 

Sound correct?

Posted
I have tested (with the /L switch) and works. Got about 150GB of data in RMShared and RMStaff that hasn't been accessed since the migration of CC3 to CC4 in the Summer of 2013 (About 40% of space used)
  • Thanks 1
Posted
So do it and if they complain restore from archive. If they don't notice it wasn't essential.

 

Essential doesn't mean have to have it at my fingertips 24/7, just not deleted.

 

I've been categorically told I am not to move anything from the staff shared areas

Posted
I suggest you do the costing exercise I outlined. As a follow up if they flat refuse to do anything you have no choice but to implement quotas.
Posted
I've been categorically told I am not to move anything from the staff shared areas

 

Move to an external USB HDD, map with the same share name and make it read only - they won't notice and it you can take it out of your backup regime, making that quicker as well as recovering space on the server.

  • Thanks 1
  • 2 weeks later...
Posted
Is there a way to list files that includes their last access date & file size (filepath would be nice) to a .csv file so that I can sort it to present to my LM?
Posted
Is there a way to list files that includes their last access date & file size (filepath would be nice) to a .csv file so that I can sort it to present to my LM?

 

I was going to use treesize to point me in the right direction, but quickly discovered that it reported last change dates as more recent than last access dates. A quick Google suggested that this was to do with the way the OS reported details, rather than treesize. I'd therefore be a bit wary of using reported last access dates for archiving. Would be very happy to hear about a way to overcome this though...

  • Thanks 1
Posted
Just to raise an issue here as it was overlooked when I did this. We used last accessed date to archive files but then found out that at some point it was turned off on the server. The result was that for some files the last modified was being updated but the last accessed wasn't - resulting in current files being archived. Kind of put a stop to archiving by last accessed date.
Posted
Just to raise an issue here as it was overlooked when I did this. We used last accessed date to archive files but then found out that at some point it was turned off on the server. The result was that for some files the last modified was being updated but the last accessed wasn't - resulting in current files being archived. Kind of put a stop to archiving by last accessed date.

 

I just came here to point out exactly that. It's something that came into play in 2008 or 2008R2 version of windows server, you have to actually turn on via a registry edit. Luckily i found this out after extensive testing before actually moving anything.

 

Not sure if it still applies to 2012 and 2012R2, though i would assume so, and i doubt many/anyone here is still using 2003 for their file servers to not be affected by it.

  • 2 weeks later...
Posted (edited)
Just to raise an issue here as it was overlooked when I did this. We used last accessed date to archive files but then found out that at some point it was turned off on the server. The result was that for some files the last modified was being updated but the last accessed wasn't - resulting in current files being archived. Kind of put a stop to archiving by last accessed date.

 

I just came here to point out exactly that. It's something that came into play in 2008 or 2008R2 version of windows server, you have to actually turn on via a registry edit. Luckily i found this out after extensive testing before actually moving anything.

 

Not sure if it still applies to 2012 and 2012R2, though i would assume so, and i doubt many/anyone here is still using 2003 for their file servers to not be affected by it.

 

I experienced the same issue here too; (although majority of files did have different modified & last accessed datestamps) where I archived files (not accessed in 2+ years) off our live (2008) file server only for many departments stating files/folders had gone which were current and had been used within the past few weeks/months... In the interim, had to revert everything, and working on an alternative solution.

Edited by MYK-IT

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...