Copying a directory

  • Thread starter Thread starter Deleted member 67029
  • Start date Start date
D

Deleted member 67029

Guest
How does one copy a directory? I tried the following command, but it didn't work:

cp foo/ bar/
 
This command did not work:

cp -R foo/bar
 
Why is FreeBSD refusing to copy these three files?

Dump.png
 
See that part that says "socket not copied"? It's not copied because it's a socket. Why not copy sockets? Because sockets are transient entites, simply a pipe for communications and copying them makes no sense.
 
It looks like a file to me, but ok. Thanks
 
It looks like a file to me, but ok. Thanks
Fundamental paradigm of Unix and all Unix-like systems:
Everything is a file or looks like a file, but it may not actually be what a user would think of as "a file".

when you "ls" a directory, you are simply seeing a list of "named things" in that directory. A directory is also a "named thing" which is why they also show up when you do "ls".

If you want more information about what a named thing may be, use the command "file". For information about that command and other commands, use the command "man" (short for "manual pages", also known as "help"):

man file
man man

That is basic information about just about any Unix or Unix-like system you may run across.
 
It looks like a file to me, but ok. Thanks
Try "ls -F", it decorates every file system object with what kind of thing it is in its output. Regular files don't get decorated at all. Executable files get a "*" behind them. Directories get a trailing slash like "dir/". Soft links get an "@". And strange file system entries (devices, socket, fifos, ...) get stranger characters.

Obviously, this works best if your file names don't contain such special characters. But there are good reasons to not use special characters in file names: While technically any character other than "/" and NUL is legal in file names, special characters will cause confusion. For example, look on the internet for the story of the boy who created a file called "*", and tried to delete it with "rm *". Oops.
 
It looks like a file to me, …

Hints:

Code:
root@mowa219-gjp4-8570p:~ # file /var/run/log
/var/run/log: socket
root@mowa219-gjp4-8570p:~ #

man 1 file

Code:
root@mowa219-gjp4-8570p:~ # bfs -s -type s /var/run
/var/run/devd.pipe
/var/run/devd.seqpacket.pipe
/var/run/log
/var/run/logpriv
/var/run/cups/cups.sock
/var/run/dbus/system_bus_socket
/var/run/user/1002/kdeinit5__0
/var/run/user/1002/klauncheriYzkqN.1.slave-socket
/var/run/user/1002/vscode-f8b69df7-1.56.2-main.sock
/var/run/user/1002/vscode-git-6c564a3a88.sock
/var/run/user/1002/akonadi/akonadiserver-cmd.socket
/var/run/user/1002/akonadi/akonadiserver-ntf.socket
/var/run/user/1002/keyring/control
root@mowa219-gjp4-8570p:~ #

sysutils/bfs
 
Back
Top