Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Can a file backup be appended to a copy in the destination folder

09 Dec 2016   #1
trunxson

Windows7 32bit
 
 
Can a file backup be appended to a copy in the destination folder

I want to run a script as a bat file so it can be scheduled as a daily task. I think that ROBOCOPY is my best option but i cannot find suitable switches to make the script do what i want.

I want to copy "eventfile.txt" from a source to destination folder.
However, as this is a daily task, eventfile.txt will have a different text content each day (it is in fact my openvpn logfile) and after robocopy is run only the latest version of the file is copied to the destination, the previous day being overwritten.
What I want it to do is append eventfile.txt to the destination file so I can build a history of all my vpn events. None of the switches appear to allow me to do that.
Is there a workaround for this task or another way of doing this?


My System SpecsSystem Spec
.
11 Dec 2016   #2
cyanna

windows 7 ultimate x64
 
 

It'll have to be a bit more complicated than a switch. The following batch file will rename each log file by adding the date and time of creation.

Code:
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a" 
set "YY=%dt:~2,2%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%" 
set "datestamp=%YY%%MM%%DD%"  
set "datafolder=WHEREVER YOUR LOG FILE TO BE COPIED IS" 
set "backupfolder=WHEREVER YOU WANT THE COPY TO GO\%datestamp%"  
set switches=/r:0 /w:0 /mir /ns /nc /ndl /np /njh /njs  robocopy %switches% "%datafolder%" "%backupfolder%"  
pause
My System SpecsSystem Spec
11 Dec 2016   #3
trunxson

Windows7 32bit
 
 

That was just great. works as expected .
Thanks!
My System SpecsSystem Spec
.

11 Dec 2016   #4
cyanna

windows 7 ultimate x64
 
 

Glad it worked!
My System SpecsSystem Spec
Closed Thread

 Can a file backup be appended to a copy in the destination folder




Thread Tools




Similar help and support threads
Thread Forum
Windows Backup cannot read the backup destination, Error: 0x8078006F
Hi I'm running Windows 7 Ultimate connected to network with Server 2008 (R2). I am trying to backup the System Image to a share on the server without success: Windows Backup: Troubleshooting Options Check your backup Windows Backup cannot read the backup destination.
Backup and Restore
Trying to copy backup file from one HD to another
So I created a backup of a friend's laptop on my external hard drive because she didn't own one yet. Now she's bought one and I'm trying to copy the backup file to it. When I drag the file to copy I get a message saying I will need admin permissions to copy, but when I just click continue it...
Backup and Restore
File name too long for destination folder?
Backing up an entire SSD to large HDD using a copy command. I received the following message indicating that 50,000 files are too long. Can anyone explain this situation and what I must do different?
General Discussion
Shadow file copy, not sync backup
I'm looking for a shadow file copy program to copy files upon creation, modification, or rename. More precisely, to copy a file whenever the file is closed, or to copy newer files to a target tree on a schedule or when manually started. Not one-direction sync, which will copy a source folder...
Software
File Name(s) Would Be Too Long for the Destination Folder
Sorry if this is a repeat post but Iíve found so much about this issue that Iím bewildered & havenít found a Fix. Iím 65 & legally blind so searching the net isnít as easy as it used to be. I have one of a kind Family pics that if lost are gone forever so I back them up on 2 ext HDís in case 1...
General Discussion
xcopy - destination folder becomes a hidden system folder - why?
Hi, I've created a batch file containing the xcopy command to copy the entire partitioned drive to a folder on an external hard drive. However, when it is executed it works fine but the destination folder, called Backup, becomes a hidden system folder. Does any one know why this is the...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 22:23.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App