Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
COPY(1)			    Schily's USER COMMANDS		       COPY(1)

NAME
       copy - makes copies of file(s)

SYNOPSIS
       copy -i [ options ]

       copy with prompt	for filenames

       copy [ options ]	from_file to_file

       copy a single file

       copy [ options ]	from1...fromn targetdir

       copy multiple files into	one directory that must	exist

DESCRIPTION
       Copy  makes  a copy of the first	file and gives it the second filename.
       If the first file does not exist	or cannot be opened or if  the	second
       file  cannot be created or opened, copy prints an error message.	If the
       second file already exists, it is overwritten.

       Copying directories, devices, fifos and the like	are permitted, but are
       treated differently. Copying a directory	just creates the target	direc-
       tory. Copying a device just creates a new device	node. Copying  a  fifo
       just creates a new fifo.

       To  copy	 multiple  source files	to a target directory: list the	source
       files on	the command line followed by the name of the target directory.
       Copy verifies that the last named file is indeed	a directory before at-
       tempting	the copy or reporting an error.

OPTIONS
       -force-hole
	      Try to enforce the target	filee to be a sparse file. To  achieve
	      this,  copy  reads  the file in 512 Byte blocks. If a block only
	      contains null bytes, no data is written to the target file. This
	      option works if the filesystem for the target file allows	one to
	      create sparse files, regardless of the state of the source file.

       -i     Interactive.  If file type  arguments  are  present,  copy  will
	      prompt for confirmation whenever the copy	would overwrite	an ex-
	      isting target.  A	"y" answer means that the copy should proceed.
	      Any  other  answer prevents copy from overwriting	target.	 If no
	      file type	arguments are present, copy will prompt: From: To: un-
	      til either a ^C, ^D, or an empty line is typed.

       -q     Query.  Requests confirmation before each	file; "y" or "yes"  to
	      do the copy, anything else to skip the file.

       -R     POSIX  recursive.	 If the	from file is a directory, copy creates
	      not only the target directory but	recursively  copies  all  sub-
	      files. If	the target directory exists, a directory type from pa-
	      rameter  always results in a concatenation of the	last path name
	      component	of the from parameter and the target directory name.

	      If the target directory does not exist in	POSIX  recursive  copy
	      mode  and	there are only two directory type parameters, the tar-
	      get directory is created and the content of the  from  directory
	      is  copied  to the target	directory.  This is different from the
	      case when	the target directory exists.

       -r     Recursive.  Same as -R but if there are only two directory  type
	      path  parameters,	 the  content  of  the	from directory will be
	      copied into target directory.

       -setowner
	      Setowner.	 Attempts to copy the original user id (only the  sys-
	      tem administrator	can do this).

       -setgrp
	      Setgroup.	 Attempts to copy the original group id	(only the sys-
	      tem administrator	can do this).

       -s     Attempts	to copy	both, the owner- ant the group-id of the files
	      (only the	system administrator can do this).

       -olddate, -o
	      Olddate Attempts to copy the original date and time.

       -p     Attempt to preserve file permissions, file owner id, file	 group
	      id  and  file times.  If copy fails to set the owner id or group
	      id on the	new file, the  permissions  S_ISUID  and  S_ISGID  are
	      cleared.

       -sparse
	      Attempt to preserve holes	in sparse regular files.  On platforms
	      that  support  SEEK_DATA	and  SEEK_HOLE lseek(2)	whence values,
	      copy is able to efficiently and correctly	restore	all hole posi-
	      tions.

       -v     Verbose Reports the result of the	copy.

NOTES
       If the target file does not exist, copy attempts	to retain the original
       user access modes even if -p has	not been specified. Copying  a	device
       file  results in	only copying the device	file entry, not	in reading the
       device.

       When copying an entire directory	(using the -r option), the target  di-
       rectory	should not exist. Otherwise, a subdirectory with the same name
       as the source directory is created and used as the destination for  all
       the files.

       No  slash  will	be accepted in the interactive mode if the environment
       variable	'SLASH=off' is set.

BUGS
       None currently known.

       Mail bugs and suggestions to schilytools@mlists.in-berlin.de or open  a
       ticket at https://codeberg.org/schilytools/schilytools/issues

       The mailing list	archive	may be found at:

       https://mlists.in-berlin.de/mailman/listinfo/schilytools-mlists.in-berlin.de

AUTHORS
       Joerg Schilling and the schilytools project authors.

SOURCE DOWNLOAD
       The source code for copy	is included in the schilytools project and may
       be retrieved from the schilytools project at Codeberg at:

       https://codeberg.org/schilytools/schilytools/

       The download directory is:

       https://codeberg.org/schilytools/schilytools/releases

Joerg Schilling			  2022/09/09			       COPY(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=copy&sektion=1&manpath=FreeBSD+Ports+14.3.quarterly>

home | help