alias
From: krischik
| Code:
| alias CopyDir=COPY /L /S /E /X /Y /H /Z
| alias MoveDir=RENAME /S
|
| While this will do what the OP wish for this solution is pretty difficult to work out.
|
| CopyDir needs a whooping 7 option. Unix has an "--archive" options
| which combines all option needed to make a 1 to 1 copy.
| MoveDir needs to use RENAME which is not very intuitive.
|
| So I am still on favour of some convenience commands or options to
| make these important functions easier accessible. This could be two
| new commands or an addition option like the "--archive" from unix
| (added to both MOVE and RENAME so it is easier to discover them).
Actually, it is generally possible to combine options without a separate option character for each ( for your COPYDIR: /LEXYHZS), but it is deprecated for good reason. For example, the /S option has been enhanced a few versions age with suboptions (controlling how deep recursion depth starts or ends). If the character describing a future suboption is already a valid option, the parser would not be able to determine what you wanted. Separating each option makes it unambiguous even if there is an enhancement in the future.
Furthermore, in POSIX syntax, would you type "cp --archive" each time, or would you create an alias (eg., alias arch=cp --archive) anyway? I would - just as I created tens of aliases for various options of the DIR and PDIR commands - naming them very systematically so a particular option (or group of options) always be represented identically. For example in PDIR variants are suffixed "s" if they are to report descend into subdirectories but not into junctions (my most common usage), and with "sj" if junctions are to be searched, too.
| PS: Would RENAME /S work across a file-systems? Because unix mv does
| by performing a copy / delete in these cases.
No. As described in the HELP topic REN/RENAME it cannot cross file system (volume) boundaries. OTOH MOVE is described as performing REN if source and target are on the same volume, otherwise it performs COPY / DEL, just as POSIX' mv does.
Beware of REN /S - it does not behave in the same manner as /S in other commands. Read the HELP topic CAREFULLY.
To move a directory AND all its entries, including both files and subdirectories, you can use either REN (if remaining on the same volume) or MOVE. You do not need the /S option in either case.
--
HTH, Steve