需要帮助构建bash文件。说明和示例附上

时间:2015-03-25 23:04:16

标签: bash automation backup

我正在尝试构建一个(在我看来)复杂的bash文件,并希望知道如何编写它。我想知道如何,我不是要求你们为我做这件事:)。

说明:

#Step 1.
#Copy Folder1 from InstallDrive:\(install.directory) to BackupDrive:\(backup.directory)
##Name Copied Folder1 to *Current Date*-Folder1
#Copy Folder2 from InstallDrive:\(install.directory) to BackupDrive:\(backup.directory)
##Name Copied Folder2 to *Current Date*-Folder2
#!!!Confirm Files Were Copied fully!!!
#Delete Folder1 from InstallDrive:\(install.directory)
#Delete Folder2 from InstallDrive:\(install.directory)
#Delete Folder3 from InstallDrive:\(install.directory)
#Step 2.
#Launch Program
##Login
##Let Run for x minutes
##Exit/Terminate Program
#Step 3.
#Copy most current *Current Date* Folder1 from BackupDrive:\(backup.directory)\ to InstallDrive:\(install.directory)
#Copy most current *Current Date* Folder2 from BackupDrive:\(backup.directory)\ to InstallDrive:\(install.directory)

非常感谢任何帮助或指示。 谢谢!

1 个答案:

答案 0 :(得分:0)

太好了,现在你知道我肮脏的小秘密了。洛尔

这是我到目前为止所做的:

#Step 1.
___________________________________________________________________________

#Copy Folder1 from InstallDrive:\(install.directory) to BackupDrive:\(backup.directory)
cp "C:\Program Files (x86)\Battle.net\Games\World of Warcraft\WTF\." "H:\wow.wtf.interface.backup.DND\WTF\." -R

##Name Copied Folder1 to *Current Date*-Folder1
#How do I make a dynamic date?
#How do I rename the file in the BackupDrive:\()BackupDirectory)?

#Copy Folder2 from InstallDrive:\(install.directory) to BackupDrive:\(backup.directory)
cp "C:\Program Files (x86)\Battle.net\Games\World of Warcraft\Interface\." "H:\wow.wtf.interface.backup.DND\Interface\." -R

##Name Copied Folder2 to *Current Date*-Folder2
#How do I make a dynamic date?
#How do I rename the file in the BackupDrive:\()BackupDirectory)?

#!!!Verify Files Were Copied fully!!!
#How do I do this?

#Delete Folder1 from InstallDrive:\(install.directory)
rm "C:\Program Files (x86)\Battle.net\Games\World of Warcraft\WTF\."

#Delete Folder2 from InstallDrive:\(install.directory)
rm "C:\Program Files (x86)\Battle.net\Games\World of Warcraft\Interface\."

#Delete Folder3 from InstallDrive:\(install.directory)
rm "C:\Program Files (x86)\Battle.net\Games\World of Warcraft\Cache\."

#Step 2.
___________________________________________________________________________

#Launch Program
start "Battle.Net" "C:\Program Files (x86)\Battle.net\Battle.net Launcher.exe"
start "World of Warcraft" "C:\Program Files (x86)\Battle.net\Games\World of Warcraft\Wow-64.exe"
##Login
*User Input*
##Let Run for x minutes
?
##Exit/Terminate Program
end "Battle.Net" "C:\Program Files (x86)\Battle.net\Battle.net Launcher.exe"
end "World of Warcraft" "C:\Program Files (x86)\Battle.net\Games\World of Warcraft\Wow-64.exe"

#Step 3.
___________________________________________________________________________

#Copy most current *Current Date* Folder1 from BackupDrive:\(backup.directory)\ to InstallDrive:\(install.directory)
cp "H:\wow.wtf.interface.backup.DND\WTF\." "C:\Program Files (x86)\Battle.net\Games\World of Warcraft\WTF\." -R

#See question at ##Name Copied Folder1 to *Current Date*-Folder1

#Copy most current *Current Date* Folder2 from BackupDrive:\(backup.directory)\ to InstallDrive:\(install.directory)
cp "H:\wow.wtf.interface.backup.DND\Interface\." "C:\Program Files (x86)\Battle.net\Games\World of Warcraft\Interface\." -R

#See question at ##Name Copied Folder2 to *Current Date*-Folder2

编辑:为什么我被投票?