Linux file/directory command syntax

Computing: Software: Operating Systems: Linux: |file/directory command syntax

Examples

 * To move the contents of directory A into directory B
 * A /* B /
 * A /* B


 * To move directory A into directory B
 * A B


 * To copy the directory A into directory B (so you end up with /B/A/contents-of-A )
 * -dpR A B
 * -a A B


 * To copy the contents of A into B (so you end up with B/contents-of-A )
 * -a A /* B


 * To remove everything, including subdirectories, from the current directory (careful!)
 * -r *
 * -rf *

Notes for DOS refugees
Some command utilities in DOS (e.g. xcopy) used a convention wherein a trailing backslash on a name (e.g. c:\name\) meant that the name was a directory. This helped to disambiguate in certain circumstances where a name might refer to either a directory or a file  – that is, you couldn't have a file with the same name as a directory, but (a) the command might involve a search where the first item with that name could be either a file or a directory, or (b) the command might involve creating something new (a file or directory) and the actions to be taken would depend on what was being created.

For and, apparently "name" and "name/" as a source both indicate "whatever you find that has this name" (to check: can "name/" be a file?), while "name/*" means "the contents of the directory named "name". It's not yet clear if this is a general rule or only applicable with some commands.