Jump to content

Backing up a folder *from* a NAS to my PC

BDaishi

This might be an odd question, but I found no relevant posts when I searched and this seemed like the most logical place to make a new post.  I also did extensive searching in Google to no avail.

 

My workplace uses a NAS for data dumps.  The folder I access on there is for Excel/CSV files containing traffic counts at entrances.  IT's policy is to only keep files on there for a rolling 60 days.  I know I could set a calendar reminder every month or two to manually download the files to my computer to use them for analysis, but that is inefficient.  I would like to set up an automatic "reverse-backup" for lack of a better term... I know I can set up file backups in Windows 10, but backups are always *from* my PC to somewhere else like an external drive.  I want to make it so that it automatically downloads the contents from that NAS folder to a folder on my PC.  I would hesitate to do a true "sync" because I don't want my PC to delete any sync'ed files that get deleted from the NAS... I want to maintain all past files that were downloaded, adding only new files.  

Is there any way to do this in Windows natively, without any proprietary software?  If not, is there a freeware solution for this?  It does not seem that complicated in concept but I cannot seem to figure it out.  Thanks for any suggestions!

Other relevant info:

- I only access the NAS using wired ethernet while at work; no complications such as Wi-Fi or remote access via VPN to worry about here.  

- Dell Latitude 5420 running Windows 10

Current rig: ASUS ROG Strix G15CK

Intel Core i7-10700KF

ASUS Strix B460-G motherboard

2x16GB Crucial Ballistix DDR4-3000

NVIDIA GeForce RTX 2060S


Previous rig: HP Omen 870-255xt

Intel Core i7-7700

Thimphu-K (OEM motherboard)

4x8GB DDR4-2133

NVIDIA GeForce GTX 1070

Link to comment
Share on other sites

Link to post
Share on other sites

25 minutes ago, BDaishi said:

This might be an odd question, but I found no relevant posts when I searched and this seemed like the most logical place to make a new post.  I also did extensive searching in Google to no avail.

 

My workplace uses a NAS for data dumps.  The folder I access on there is for Excel/CSV files containing traffic counts at entrances.  IT's policy is to only keep files on there for a rolling 60 days.  I know I could set a calendar reminder every month or two to manually download the files to my computer to use them for analysis, but that is inefficient.  I would like to set up an automatic "reverse-backup" for lack of a better term... I know I can set up file backups in Windows 10, but backups are always *from* my PC to somewhere else like an external drive.  I want to make it so that it automatically downloads the contents from that NAS folder to a folder on my PC.  I would hesitate to do a true "sync" because I don't want my PC to delete any sync'ed files that get deleted from the NAS... I want to maintain all past files that were downloaded, adding only new files.  

Is there any way to do this in Windows natively, without any proprietary software?  If not, is there a freeware solution for this?  It does not seem that complicated in concept but I cannot seem to figure it out.  Thanks for any suggestions!

Other relevant info:

- I only access the NAS using wired ethernet while at work; no complications such as Wi-Fi or remote access via VPN to worry about here.  

- Dell Latitude 5420 running Windows 10

This is a rather simple issue and you don't need any additional software to make it work.  

 

The solution is to look up the command XCOPY or ROBOCOPY.  These are native tools in windows for doing just such things.  Write a simple batch script around either command, and set it as a schedule rule in Windows Scheduler.  XCOPY is probably closer to what you're looking for, I think.  

 

If this is more mission critical, then you can also look up rsync, but that requires a few extra steps.  

 

Here's one I have that does nearly the same thing, you copy this into a batch file and edit parameters as necessary:

@ECHO OFF
REM Batch file to copy directories

SETLOCAL
set DestinationDir="C:\<DESTINATION FOLDER>"
set SourceDir="\\<NETWORK SHARE LOCATION>"


ROBOCOPY %SourceDir% %DestinationDir%

 

ENDLOCAL

CPU: Ryzen 5 5600X  | Motherboard: ASROCK B450 pro4 | RAM: 2x16GB  | GPU: MSI NVIDIA RTX 2060 | Cooler: Noctua NH-U9S | SSD: Samsung 980 Evo 1T 

Link to comment
Share on other sites

Link to post
Share on other sites

As Lapsed said, Robocopy is your friend here. It can do a lot of advanced things using switches. 

Some notable ones for you would be:

 

/MIR - Mirror a directory tree/structure

/COPYALL - Copies Data, Attributes & Timestamps

/DCOPY:T - Copies Timestamps for directories

/XO - Exclude older files (if a newer one exists in the destination it will not overwrite it)

/LOG+:<filename> - You can create a log that you can go back through to see whats been done

/MT:<number of threads> - Multithread file copies for increased performance, good for dealing with lots of small files.

 

So using Lapsed batch script, your command line might look something like this

robocopy %SourceDir% %DestinationDir% /MIR /COPYALL /DCOPY:T /XO /MT:8 /LOG+:C:\Temp\mybackups.log

 

When you're happy with it, you can use Task Scheduler to setup a recurring job to run the batch script. 

 

You can also test it doing a "dry run" by using the /L switch

If you add /L (means List-only), then it will still create your log (defined by /LOG+:<filename>) to show you what actions it would take, but it does not actually run a copy. It only shows you what actions it would take if it were to really be run. You can remove the /L switch when youre happy with what its doing. This is more useful if youre wanting to merge existing data and remove old sources but want to double check you have your command line correct before making a change. Probably not required in your case. 

Spoiler

Desktop: Ryzen9 5950X | ASUS ROG Crosshair VIII Hero (Wifi) | EVGA RTX 3080Ti FTW3 | 32GB (2x16GB) Corsair Dominator Platinum RGB Pro 3600Mhz | EKWB EK-AIO 360D-RGB | EKWB EK-Vardar RGB Fans | 1TB Samsung 980 Pro, 4TB Samsung 980 Pro | Corsair 5000D Airflow | Corsair HX850 Platinum PSU | Asus ROG 42" OLED PG42UQ + LG 32" 32GK850G Monitor | Roccat Vulcan TKL Pro Keyboard | Logitech G Pro X Superlight  | MicroLab Solo 7C Speakers | Audio-Technica ATH-M50xBT2 LE Headphones | TC-Helicon GoXLR | Audio-Technica AT2035 | LTT Desk Mat | XBOX-X Controller | Windows 11 Pro

 

Spoiler

Server: Fractal Design Define R6 | Ryzen 3950x | ASRock X570 Taichi | EVGA GTX1070 FTW | 64GB (4x16GB) Corsair Vengeance LPX 3000Mhz | Corsair RM850v2 PSU | Fractal S36 Triple AIO | 12 x 8TB HGST Ultrastar He10 (WD Whitelabel) | 500GB Aorus Gen4 NVMe | 2 x 2TB Samsung 970 Evo Plus NVMe | LSI 9211-8i HBA

 

Link to comment
Share on other sites

Link to post
Share on other sites

On 9/27/2022 at 1:10 PM, LapsedMemory said:

This is a rather simple issue and you don't need any additional software to make it work.  

 

The solution is to look up the command XCOPY or ROBOCOPY.  These are native tools in windows for doing just such things.  Write a simple batch script around either command, and set it as a schedule rule in Windows Scheduler.  XCOPY is probably closer to what you're looking for, I think.  

 

If this is more mission critical, then you can also look up rsync, but that requires a few extra steps.  

 

Here's one I have that does nearly the same thing, you copy this into a batch file and edit parameters as necessary:

@ECHO OFF
REM Batch file to copy directories

SETLOCAL
set DestinationDir="C:\<DESTINATION FOLDER>"
set SourceDir="\\<NETWORK SHARE LOCATION>"


ROBOCOPY %SourceDir% %DestinationDir%

 

ENDLOCAL

This is incredibly helpful - I am not very familiar with creating batch files, so I would not have thought about this.  I will look up all those commands to learn them but will likely copy/paste what you suggested there.  Thank you for the advice!  

Current rig: ASUS ROG Strix G15CK

Intel Core i7-10700KF

ASUS Strix B460-G motherboard

2x16GB Crucial Ballistix DDR4-3000

NVIDIA GeForce RTX 2060S


Previous rig: HP Omen 870-255xt

Intel Core i7-7700

Thimphu-K (OEM motherboard)

4x8GB DDR4-2133

NVIDIA GeForce GTX 1070

Link to comment
Share on other sites

Link to post
Share on other sites

21 hours ago, Jarsky said:

As Lapsed said, Robocopy is your friend here. It can do a lot of advanced things using switches. 

Some notable ones for you would be:

 

/MIR - Mirror a directory tree/structure

/COPYALL - Copies Data, Attributes & Timestamps

/DCOPY:T - Copies Timestamps for directories

/XO - Exclude older files (if a newer one exists in the destination it will not overwrite it)

/LOG+:<filename> - You can create a log that you can go back through to see whats been done

/MT:<number of threads> - Multithread file copies for increased performance, good for dealing with lots of small files.

 

So using Lapsed batch script, your command line might look something like this

robocopy %SourceDir% %DestinationDir% /MIR /COPYALL /DCOPY:T /XO /MT:8 /LOG+:C:\Temp\mybackups.log

 

When you're happy with it, you can use Task Scheduler to setup a recurring job to run the batch script. 

 

You can also test it doing a "dry run" by using the /L switch

If you add /L (means List-only), then it will still create your log (defined by /LOG+:<filename>) to show you what actions it would take, but it does not actually run a copy. It only shows you what actions it would take if it were to really be run. You can remove the /L switch when youre happy with what its doing. This is more useful if youre wanting to merge existing data and remove old sources but want to double check you have your command line correct before making a change. Probably not required in your case. 

Thank you for contributing the additional information - as I replied to Lapsed, I am not very familiar with creating batch files so this is all pretty new to me.  I appreciate all of this, this is very much a learning experience for me!

Current rig: ASUS ROG Strix G15CK

Intel Core i7-10700KF

ASUS Strix B460-G motherboard

2x16GB Crucial Ballistix DDR4-3000

NVIDIA GeForce RTX 2060S


Previous rig: HP Omen 870-255xt

Intel Core i7-7700

Thimphu-K (OEM motherboard)

4x8GB DDR4-2133

NVIDIA GeForce GTX 1070

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, BDaishi said:

Thank you for contributing the additional information - as I replied to Lapsed, I am not very familiar with creating batch files so this is all pretty new to me.  I appreciate all of this, this is very much a learning experience for me!

 

With Lapsed script, all you do is open Notepad, paste in the commands:

 

@ECHO OFF
REM Batch file to copy directories

SETLOCAL
set DestinationDir="C:\<DESTINATION FOLDER>"
set SourceDir="\\<NETWORK SHARE LOCATION>"
set LogFile="C:\Temp\mybackup.log"

ROBOCOPY %SourceDir% %DestinationDir% /MIR /COPYALL /DCOPY:T /XO /MT:8 /LOG+:%LogFile%

ENDLOCAL

 

Replace <DESTINATION FOLDER> with the Root folder of where you want to save the files to (e.g D:\MyBackup)

Replace <NETWORK SHARE LOCATION> with the Root folder of where you want to copy files from  (e.g \\nas\share\myfiles)

 

Save the fie using the .bat extension (instead of .txt). e.g 

 

image.png.5f044a5f6c4ef7f181a51c215e690cb1.png

 

Then in Task Scheduler, select "Create a Basic Task"..follow it through and on "Action" select start a program. 

Select the bat file you created. 

 

You can manually trigger the task you created by right clicking it and go "Run" to test it out. 

 

Spoiler

Desktop: Ryzen9 5950X | ASUS ROG Crosshair VIII Hero (Wifi) | EVGA RTX 3080Ti FTW3 | 32GB (2x16GB) Corsair Dominator Platinum RGB Pro 3600Mhz | EKWB EK-AIO 360D-RGB | EKWB EK-Vardar RGB Fans | 1TB Samsung 980 Pro, 4TB Samsung 980 Pro | Corsair 5000D Airflow | Corsair HX850 Platinum PSU | Asus ROG 42" OLED PG42UQ + LG 32" 32GK850G Monitor | Roccat Vulcan TKL Pro Keyboard | Logitech G Pro X Superlight  | MicroLab Solo 7C Speakers | Audio-Technica ATH-M50xBT2 LE Headphones | TC-Helicon GoXLR | Audio-Technica AT2035 | LTT Desk Mat | XBOX-X Controller | Windows 11 Pro

 

Spoiler

Server: Fractal Design Define R6 | Ryzen 3950x | ASRock X570 Taichi | EVGA GTX1070 FTW | 64GB (4x16GB) Corsair Vengeance LPX 3000Mhz | Corsair RM850v2 PSU | Fractal S36 Triple AIO | 12 x 8TB HGST Ultrastar He10 (WD Whitelabel) | 500GB Aorus Gen4 NVMe | 2 x 2TB Samsung 970 Evo Plus NVMe | LSI 9211-8i HBA

 

Link to comment
Share on other sites

Link to post
Share on other sites

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

×