VirtualBox

Changeset 97345 in vbox


Ignore:
Timestamp:
Oct 31, 2022 11:25:51 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154343
Message:

Guest Control/FE/VBoxManage: Added new options "--no-replace / -n" and "--update / -u" for the copyfrom / copyto subcommands, to also being able to test + use those.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp

    r97343 r97345  
    16021602        { "--follow",              'L',     RTGETOPT_REQ_NOTHING }, /* Kept for backwards-compatibility (VBox < 7.0). */
    16031603        { "--dereference",         'L',     RTGETOPT_REQ_NOTHING },
     1604        { "--no-replace",          'n',     RTGETOPT_REQ_NOTHING }, /* like "-n" via cp. */
    16041605        { "--recursive",           'R',     RTGETOPT_REQ_NOTHING },
    1605         { "--target-directory",    't',     RTGETOPT_REQ_STRING  }
     1606        { "--target-directory",    't',     RTGETOPT_REQ_STRING  },
     1607        { "--update",              'u',     RTGETOPT_REQ_NOTHING }  /* like "-u" via cp. */
    16061608    };
    16071609
     
    16151617    bool fFollow = false;
    16161618    bool fRecursive = false;
     1619    bool fUpdate = false; /* Whether to copy the file only if it's newer than the target. */
     1620    bool fNoReplace = false; /* Only copy the file if it does not exist yet. */
    16171621
    16181622    int vrc = VINF_SUCCESS;
     
    16311635                break;
    16321636
     1637            case 'n':
     1638                fNoReplace = true;
     1639                break;
     1640
    16331641            case 'R':
    16341642                fRecursive = true;
     
    16381646                pszDst = ValueUnion.psz;
    16391647                fDstMustBeDir = true;
     1648                break;
     1649
     1650            case 'u':
     1651                fUpdate = true;
    16401652                break;
    16411653
     
    17421754        if (fFollow)
    17431755            strCopyFlags += "FollowLinks,";
     1756        if (fUpdate && !fIsDir)    /* Only affects files. */
     1757            strCopyFlags += "Update,";
     1758        if (fNoReplace && !fIsDir) /* Ditto. */
     1759            strCopyFlags += "NoReplace,";
    17441760       aCopyFlags.push_back(Bstr(strCopyFlags).raw());
    17451761    }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette