Solved cp command - "invalid argument" result

I have selected a group of files I wish to copy to a USB stick.

I mounted USB stick via ls /dev/da* and that resulted with da0 and da0s1.

mount_msdosfs /dev/da0s1 /media/usb resulted in successful mount.

Tested via cd /media/usb and ls result is system volume.

mkdir /media/usb/my_dir and ls result is /media/usb/my_dir shown

Verification of successful mount--then, as ROOT, I navigated to my the location of the files I wish to copy to USB drive.

cd /home/user_name/my_dir (four sub directories, each containing multiple files)
cp -R /home/user_name/my_dir /media/usb/my_dir

I visually see server display:
Code:
cp (file name) :invalid argument

I then navigated back to the file location and ls -l |more showed the ownership was user_name:wheel for each file

Thinking user:group ownership it may be an issue...

chown -R root:wheel /home/user_name/my_dir then ls -l |more verifies all files now owned by root:wheel

Execute command again... same "invalid argument" response

Any ideas?
 
PS: freebsd FreeBSD release 8.0

First used:
find . -type f -mtime +1 -mtime -30 -exec cp {} /home/user_name/my_dir1/my_dir2/ /home/user_name/my_dir/my_files \;

I ran this four times, changing the path to four locations (my_dir2), and it successfully found files modified in last 30 days and populated each of the four my_files sub directories under /home/user_name/my_dir/my_files(1,2,3,4).
 
The MS-DOS filesystem does not support many features that are present in current filesystems. That could include special characters in filenames, permissions, or file flags. Examine the files being copied.
 
The answer is...
#cd /home/user_name/my_dir
#tar cvvpzf my_file.tar.gz /media/usb/my_folder

Changing the file type to a .tar.gz overcame the "write" incompatibility.

FYI... I did fdisk the USB and changed file structure to freebsd (sysid 162) and then chowned, chmoded, but still obtained "invalid argument"...
 
The problem was probably caused by a file whose name started with a dash.

One solution is to use cp --. The "--" means "no more options" so everything after it will be treated as a filename. This also works for other tools (like rm, mkdir, touch, etc.):

Code:
$ ls
-strangename
$ cp *strange* /tmp
cp: illegal option -- s
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file target_file
  cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file ... target_directory
$ cp -- *strange* /tmp
$ rm -- *strange*
$ ls
$
 
Back
Top