WinSCP script- Want to automate the copy of files

Advertisement

VictorIT1
Guest

WinSCP script- Want to automate the copy of files

Hi,

Need help with this daily manual code script.

Help in changing script to automate

1. Automatically pull a list of source folder names from \\ipaddress\backups\LatestOfEach\

There are many folders similar to VMNAME-421b33f2-ca0f-1279-633f-fe7f84d3b6a2-20110601_000316
VMNAME-GUID---------------------------------date----_time--

2. To use the put command while ignoring the source folder -date_time.

The source folders cannot be renamed...

3. During the put command rename the files in the source folder to the correct name format.

i.e. Source folders have files names as:
VMNAME-scsi0_0-flat.vmdk
VMNAME-scsi0_0.vmdk
VMNAME-scsi0_1-flat.vmdk
VMNAME-scsi0_1.vmdk
.
.
.
Destination files should be named: (Correspond to source files)
VMNAME-flat.vmdk
VMNAME.vmdk
VMNAME_1-flat.vmdk
VMNAME_1.vmdk
.
.
.
Skilled help is VERY much welcome. :-) - Shocker...

Here is the current code:


##############################################################################
# Author: VictorIT1
# Date: 20110531
# Purpose: Replicate all previous day backups to secondary SAN storage
# What it does: Logins to ESXi host and (remote) directory, then in binary
# batch mode get or put files to specific target.
# How to call this script:
#winscp.exe /console /script=c:\scripts\replication_script.txt /log="c:\scripts\replicationlog.txt"
# or
# use Windows Scheduler
# Requirement: Net map R: as persistent to \\X.Y.Z.149\backups\LatestOfEach
# Or AS DONE HERE use the UNC path (instead of a mapped drive)
# user: username password: correct-password on local system before using.
##############################################################################
#
option batch on
option confirm off
open scp://root:@passwordhere@ESX4.1Update1host.dom
cd/vmfs/volumes/
option transfer binary
# VMNAME1
put \\X.Y.Z.149\backups\LatestOfEach\VMNAME1-421b33f2-ca0f-1279-633f-fe7f84d3b6a2-20110601_000316\*.vmdk /vmfs/volumes/DataCore2/VMNAME1/*.vmdk
# VMNAME2
put \\X.Y.Z.149\backups\LatestOfEach\VMNAME2-420068db-9b0b-f396-75ef-345418ec76e7-20110601_000316\*.vmdk /vmfs/volumes/DataCore3/VMNAME2/*.vmdk
# VMNAME3
#put \\X.Y.Z.149\backups\LatestOfEach\VMNAME3-503c248e-44b8-7e1c-b7e2-159a60cf421e-20110601_000316\*.vmdk /vmfs/volumes/DataCore3/VMNAME3/*.vmdk
close
exit

Reply with quote

Advertisement

VictorIT1
Guest

Thanks

prikryl,

Thanks for the script referal. It is kind of doing the opposite of what I am looking for, but the components of the script give enough knowledge to probably allow for adaption.

Thanks again,

VictorIT1

Reply with quote

Advertisement

You can post new topics in this forum