Glam Prestige Journal

Bright entertainment trends with youth appeal.

I have an unusual problem, which is possibly down to me being a novice command line user, but also applies to using the GUI.

The situation is that I have a networked drive mounted at /media/drive/dir using a cifs mount at log-in (via modified fstab, permissions 0777 for both dirs and files) and I want to copy a directory containing several sub-directories with up to 100's of files (3rd-gen sequencing) in each to /home/USER/Desktop/dest. To do this I use:

cp -r /media/drive/dir /home/USER/Desktop/dest

When this runs, cp completes with no error messages, but not all the sub-directories are there, and the sub-sub directories are also sometimes missing. The same command works fine copying files from other locations within the local system, it only seems to happen for the networked drive. This phenomenon also happens when I use the copy/paste command from the GUI. I can individually copy the files/directories, but this is very laborious and time consuming.

I have read many of the other threads on here and cannot find any that are comparable. Any help appreciated.

1

2 Answers

Most probably the reason is that the source directory contains symbolic links.

From :

When copying from a symbolic link, cp normally follows the link only when not copying recursively or when --link (-l) is used. This default can be overridden with the --archive (-a), -d, --dereference (-L), --no-dereference (-P), and -H options. If more than one of these options is specified, the last one silently overrides the others.

Add the -L-option to your cp- command:

cp -rL /media/drive/dir /home/USER/Desktop/dest 
1

In the hope that this will help someone else out someday:

It turns out it was a degradation of the connection between the computer and the server, and a simple restart of the system and re-mounting the server worked to repair this connection and the files copied correctly with the original command.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy