Plist 简述

How to copy items from one or more folders to a target folder under MAC by shell

  1. Purpose:
    let’s say we have one or more folders that need to be copied to another folder which can be saved in the cloud server.

  2. How to :
    2.1 under mac OS
    2.2 by shell

  3. use utility cp command to copy the folder or files,
    **attention: cp will overwrite the target files no matter if the content of the source file conflicts with the target one.

  4. Try to make the cp commands into one file
    ** try to use vi
    ** try to invoke a bash script file, try “.” to invoke

  5. make that one file run in a scheduler
    ** try to use cron command
    ** the alternative in MAC OS is to use LaunchCtl which will deliver jobs to Launchd to run .
    Notes to use LaunchCtl:
    a) make the script file executable by issuing chmod +x your_scripfile
    b) make a plist file , and place it under the directory ~/Library/LaunchAgents/. So that this script would be launched each time you login. There are many other system directories you can put your plist file, you can have a detailed explanation by issuing man Lauchd.Plist. Attention, you must name your script file end in a .plist.
    c) start running the script file : launchctl start

    here is an example of plist file :

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//APPLE//DTD PLIST 1.0//EN"
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
        <dict>
                <key>Label</key>
                <string>files.sync</string>
                <key>programarguments</key>
                <array>
              <string>/users/lewis/tools/syncfiles</string>
                </array>
                <key>StartInterval</key>
                <integer>3600</integer>
        </dict>
</plist>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dbLenis

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值