How can I backup target files with xcopy? - batch-file

I change my project files on live by copying only the changed files with one xcopy command. Is it possible to back-up the target files (only the changing ones) into another location with xcopy? Or with a batch script?
Sorry, my question is not clear enough, here are some further explanation:
I have files in folder A that I xcopy to folder B. But I need to backup the files in folder B that are overwritten. How can I do this the easiest way?
Thanks.

xcopy /d
from the xcopy help
/D:mm-dd-yyyy
Copy files changed on or after the specified date.
If no date is given, copy only files whose
source date/time is newer than the destination time.

Related

where is my batch file?

I made several bat files using task scheduler(custom) and I need to apply these to all of my 70 server computers. Obviously I don't want to repeat the same procedure at every server.
Can I simply copy and paste my bat files to different computers and expect same result?
If so, where are my bat files and where should I paste them?
Simply copy your batch files to different servers.
This post here shows location of task scheduler.
Folder location:
%systemroot%\System32\Tasks
Registry:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Schedule\Taskcache\Tasks
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Schedule\Taskcache\Tree
You may want to try the xcopy and for command to send your batch file to all servers.
Command syntax:
FOR command can loop through your server names, and XCOPY copys the batch script to the other servers.
for %%G in (serverA
serverB
serverC
...
serverZ) do xcopy [source] [destination] [options]
Note that asterisks does not work as intended, since it works as a wildcard.

Batch script to archive logs by zipping

I have a requirement for a batch script. I have log file under below directory (actually multiple directories with different names under E:\TIBCO\).
E:\TIBCO\*\6.0.0\LogFiles with Spotfire.Dxp.Automation.*.*
I need to perform below steps with the batch script
move (copy and delete) all the files that are with Spotfire.Dxp.*.*.* (ex Spotfire.Dxp..1.) from the above paths to E:\TIBCO\logsArchival\rotatedDir
zip all the files that are older than 60 from E:\TIBCO\logsArchival\rotatedDir to E:\TIBCO\logsArchival\ArchiveDir
delete the zip files that are older than 120 days from E:\TIBCO\logsArchival\ArchiveDir
All the above steps need to be written to the logs.
Please take a look at these links, where your requirement has been addressed before:
MS Dos Batch delete old files in directory and Batch file to delete files older than N days
You can easily customize those scripts to accomplish the remaining compression of the files. Please note, that in DOS the compress command is COMPACT. Use COMPACT /H for usage information.

Windows Batch Programming

I have some files that are automatically generated by an external sources into a local machine each day.
I have batch script, which moves the data from that source folder into a destination folder.
So i would like to move the files using time and date. But the robocopy command only accepts date.
Please see the script below
robocopy \\IP\f$\EMAILMT\202 C:\IntellinxServices\Queues\SwiftGen\MT202 *.rje /MAXAGE:%NEWDATE%

Robocopy Scripts

So I am looking for a nice batch file using the robocopy function to make a copy of my Win7 client machines Backup and Restore folders to a NAS. Each day a new folder is created in a backup set parent folder, so in theory, all I want robocopy to do is copy that new folder every night rather then the entire directory every night.
As of now - I am using robocopy /MIR but it still copies everything across each time as OLDER even though the folders haven't changed.
Any ideas how this can be done?
Cheers
Use the /XO option.
/XO : eXclude Older - if the destination file exists and is the same date
or newer than the source - don’t bother to overwrite it.
Another option would be to use the /MaxAge:1 option.
/MAXAGE:n : MAXimum file AGE - exclude files older than n days/date.
RoboCopy /?

SSIS delete folders named with a date

My process ceates automatically some new folders named with a date i.e (09-01-2011) in a directory (Archive)
How can I check the date of the folder in the directory and delete those older than a certain date?
Thanks
Use for_each_folder_enumeration technology from here:
http://microsoft-ssis.blogspot.com/2011/01/foreach-folder-enumerator.html
Analyze folder name using Script component
Check if folder is empty using Microsoft suggestion: http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/a3240e00-ac9d-4082-b1e4-72bd7f695524/
Move folder using File System Task (Copy directory)

Resources