VMware Cloud Community
DavideD
Enthusiast
Enthusiast

Help with a shell script to copy vmx files

Hello,

I have some problems to make to work my script. The scope of this script is to copy.vmx files form one storage to another one (Main and DR sites).

this script mistakes to read the directory names composed by two words

separated from the space.

for example:

Need to copy "/vmfs/volumes/datastore_A/db server/.vmx" to "/vmfs/volumes/datastore_B/db server/.vmx"

The script tries to copy

"/vmfs/volumes/datastore_A/db/.vmx" to "/vmfs/volumes/datastore_B/db"

and

"/vmfs/volumes/datastore_A/server/.vmx" to "/vmfs/volumes/datastore_B/server"

Attacched the script. Feel free to modify all that you want in this script

Thanks in advance

regards

Davide

Skype: davide_depaoli - Linkedin: http://it.linkedin.com/in/davidedepaoli
Reply
0 Kudos
2 Replies
avlieshout
VMware Employee
VMware Employee

I think the first line in the do structure must be

ls -1 "$lunSource$LINE" | {

thus between quote's or else the space would seperate it as multiple directories.

Arnim van Lieshout

Visit my blog at:

Arnim van Lieshout Blogging: http://www.van-lieshout.com Twitter: http://www.twitter.com/avlieshout If you find this information useful, please award points for "correct" or "helpful".
DavideD
Enthusiast
Enthusiast

Solved !

modified follwing lines

<![endif]><![if gte mso 9]>

ls -1 $lunSource$LINE

with

ls -1 “$lunSource$LINE”

and

cp -u "$lunSource$LINE/.vmx"

"$lunTarget$LINE"

with

cp "$""$"/.vmx "$""$"

Davide

Skype: davide_depaoli - Linkedin: http://it.linkedin.com/in/davidedepaoli
Reply
0 Kudos