簡體   English   中英

從Windows中的遠程位置復制目錄

[英]Copy a directory from remote location in windows

將整個目錄從遠程計算機(windows)復制到我的本地計算機(windows)的方法是什么?

我在windows_batch資源中嘗試使用的方法

xcopy //machinename/foldername/* C:/  /s /e

xcopy \\machinename\foldername\* C:\  /s /e

我收到錯誤消息,指出invalid number of parameters

能糾正我嗎? ??

我解決此問題的方法是使用兩個資源:

1)掛載掛載遠程目錄

2)從安裝點到本地點的remote_directory

請注意,掛載資源會在廚師運行結束時通知自己卸載,以避免掛載點停留在服務器上。

帶有遠程文件的防爆:

  share =  File::dirname(node['firefox']['http_url'])
  filename = File::basename(node['firefox']['http_url']) 
  ENV['tmpdrive'] = "Z:"
  mount "Z:" do
    action :mount
    device share
    username "my_user"
    domain "my_domain"
    password "xxxxxx"
    notifies :umount, "mount[Z:]"
  end

  # Wrokaround sous win2k3
#  batch "copy firefox source" do
#    command %Q{xcopy /YZE "Z/#{filename}" "#{ENV['TEMP']}/#{filename}"}.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR)
#    notifies :umount, "mount[Z:]", :immediately
#  end
  remote_file "#{ENV['TEMP']}/#{filename}" do
     source "file:///z:/#{filename}"
     notifies :umount, "mount[Z:]", :immediately
  end

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM