With FolderSize, we can get the file report and export the result to a csv file according to our need, such as files modified earlier than 4 years. Then we can move the files to our backup disk for archive.
Open FolderSize,
1. Choose the folder you want to analyse, click the File Reports > Oldest Files
2. The scan will start automatically, we click cancel and modify the scan option:
3. Set the number of entries to a super big one, making sure it will contain all the old files, I set to 2 years and the File age comparison attribute to “Date accessed” or ” Date Modified”, “Date created”.
4. Then click “Export Report” > As CSV…, the file will look like:
Use powershell to move the file
We can use import-csv to deal with the data in a csv file.
Anyway, there are points to consider:
- display the file name correctly, if you have some file named other than English, you may need to specify the Encoding method, UTF8 is one of the best option.
- Convert the path you get from the file into string
- It’s better the build the same file structure in the destination folder for convenience of future restore.
Import-Csv "N:\Frank\Time_Report.csv" -Encoding UTF8| ForEach-Object { # To prevent some file name displayed as unknown characters foreach ($property in $_.PSObject.properties |Where {$_.Name -eq "Folder"}) { $s_path=$_.Folder + $_.Name # assign the source path to s_path $dir=convert-path -path $_.Folder #convert the path to string $dirlen=$dir.Length-2 #Because the first and second letter are the drive letter and :, so we calculate the length from the third letter to the end. $dirpath=$dir.Substring(2,$dirlen) # First parameter of the substring means the starting point, #second parameter means the length of the substring $d_path_str= ("Z:\2007-2013"+$dirpath) # note that the d_path is string, we want the destination folder keep the same folder structure, so It will be easy for #Future reference mkdir $d_path_str -ErrorAction SilentlyContinue # Some files has same location, or some use same parent or grandparent folders, # so error message would pop up such as the folder already exist $d_path=convert-path $d_path_str # convert the string back to path echo ("moving.. "+$s_path+" to "+$d_path_str) move $s_path $d_path } }
If you want to move the files, simply replace the copy with move.