Re: recursive copy with spaces in descendants
On 05/11/2011 19:47, Chris wrote: I'm having difficulty copying a directory tree from my FreeBSD server to USB storage. The problem is that the tree contains file and folder names which have spaces, similar to the following: ./foo bar/some name.tar.gz ./foo bar/child dir/some other name.tar.gz I've tried various combinations of cp with enclosing the top level directory in quotations, along with other commands like tar or xargs to no avail. The problem seems to be with creating the destination directories and folders, where mkdir/cp terminates with an invalid argument response. Cleaning up the source filenames using something like detox isn't viable, as the files are being served by transmission-daemon, and as such the names must be preserved. Permissions are not an issue either, as the same responses occur whether I use a standard or root account. Any ideas would be greatly appreciated, since I'm pretty much out of them at this point. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org %mount_msdosfs /dev/da0s1 mnt #USB external HD %ls mnt %cd ~/temp2 %find . . ./dir with spaces ./dir with spaces/file1 with spaces ./dir with spaces/file2 with spaces %find . -depth |cpio -pdmv ~/mnt /home/chrisw/mnt/./dir with spaces/file1 with spaces /home/chrisw/mnt/./dir with spaces/file2 with spaces /home/chrisw/mnt/./dir with spaces /home/chrisw/mnt/. 0 blocks %find ~/mnt /home/chrisw/mnt /home/chrisw/mnt/dir with spaces /home/chrisw/mnt/dir with spaces/file1 with spaces /home/chrisw/mnt/dir with spaces/file2 with spaces or have I missed something? Chris ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
On Sat, 5 Nov 2011 15:47:20 -0400, Chris wrote: I'm having difficulty copying a directory tree from my FreeBSD server to USB storage. The problem is that the tree contains file and folder names which have spaces, similar to the following: The thing you're intending to name are properly called directories, not folders. :-) ./foo bar/some name.tar.gz ./foo bar/child dir/some other name.tar.gz I've tried various combinations of cp with enclosing the top level directory in quotations, along with other commands like tar or xargs to no avail. The problem seems to be with creating the destination directories and folders, where mkdir/cp terminates with an invalid argument response. That's a typical problem caused by those who put spaces into filenames: Scripting requires more work to do what you intend. I may point you to the following articles that deal with the _result_ of your problem: David A. Wheeler Filenames and Pathnames in Shell: How to do it correctly http://www.dwheeler.com/essays/filenames-in-shell.html David A. Wheeler: Fixing Unix/Linux/POSIX Filenames: Control Characters (such as Newline), Leading Dashes, and Other Problems http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html However, if you _can_, solve the _cause_ of your problem, i. e. educate those who create that kind of trouble-carrying file and directory names _not_ to use spaces! Any ideas would be greatly appreciated, since I'm pretty much out of them at this point. The articles should help you to deal with the problem, as they present properly working solutions. Good luck! -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
On Sun, Nov 6, 2011 at 6:35 AM, Polytropon free...@edvax.de wrote: However, if you _can_, solve the _cause_ of your problem, i. e. educate those who create that kind of trouble-carrying file and directory names _not_ to use spaces! Amen, Brother. Just because you *can*, doesn't mean you should. I blame Mac users. ;-) - M ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
In freebsd-questions Digest, Vol 387, Issue 10, Message: 34 On Sat, 5 Nov 2011 18:49:29 -0400 Chris cpubur...@gmail.com wrote: On Sat, Nov 5, 2011 at 6:20 PM, Michael Sierchio ku...@tenebras.com wrote: On Sat, Nov 5, 2011 at 3:15 PM, Chris cpubur...@gmail.com wrote: I apologize for the lack of detail. The command I'm using is: ( cd /usr/local/etc/transmission/home/Downloads/ ; tar cf - . ) | ( cd /mnt/usb ; tar xf - ) Show, don't tell. What does tar report when you run it? Indeed this helps, especially now we also know it's msdosfs .. The following messages display: ./: Can't set user=921/group=921 for . ./Reboot S1 - 01 [3FD6C4B2].mkv: Can't create 'Reboot S1 - 01 [3FD6C4B2].mkv' The last message (can't create) repeats for all files in the directory. Running 'ls -al /mnt/usb' yields: drwxr-xr-x 1 rootwheel 32768Dec 31 1979 . drwxr-xr-x 1 rootwheel 512Nov 5 03:04 .. Where /mnt/usb was originally empty in the first place. Something I've seen noone mention is that msdosfs has no concept of user or group, so Can't set user=921/group=921 for . makes perfect sense. Your 'ls -al' above showing root wheel indicates permissions related to the mount point. If you'd mounted it as a normal user it could show user user ownerships, unrelated to what msdosfs stores on the disk. Similarly, mount_msdosfs(8) -u, -g and -m switches don't affect what's written to the disk, but only how the filesystem appears to FreeBSD. For example, a 'cp -pR /etc /mnt/usb also complains about not being able to set the ownership or permissions (other than DOS' read-only attribute) on target files, but it will still copy them ok, including filenames with spaces - but not with ',+' or other non-DOS characters. So maybe tar gives up before writing, because the ownership is wrong? Perhaps the -o and -p options to tar(1) might help here, but the bottom line is that msdosfs is not really a suitable target for UFS files. I tend to use zip(1) - which keeps perms and ownership, though not hard links - to stash dirs and files on msdosfs, but format flash disks - or at least one or more slices on them - as UFS for real backup purposes. cheers, Ian ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
recursive copy with spaces in descendants
I'm having difficulty copying a directory tree from my FreeBSD server to USB storage. The problem is that the tree contains file and folder names which have spaces, similar to the following: ./foo bar/some name.tar.gz ./foo bar/child dir/some other name.tar.gz I've tried various combinations of cp with enclosing the top level directory in quotations, along with other commands like tar or xargs to no avail. The problem seems to be with creating the destination directories and folders, where mkdir/cp terminates with an invalid argument response. Cleaning up the source filenames using something like detox isn't viable, as the files are being served by transmission-daemon, and as such the names must be preserved. Permissions are not an issue either, as the same responses occur whether I use a standard or root account. Any ideas would be greatly appreciated, since I'm pretty much out of them at this point. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
I just use tar for this. ( cd /path/to/src ; tar cf - . ) | ( cd /path/to/obj ; tar xf - ) - M On Sat, Nov 5, 2011 at 12:47 PM, Chris cpubur...@gmail.com wrote: I'm having difficulty copying a directory tree from my FreeBSD server to USB storage. The problem is that the tree contains file and folder names which have spaces, similar to the following: ./foo bar/some name.tar.gz ./foo bar/child dir/some other name.tar.gz I've tried various combinations of cp with enclosing the top level directory in quotations, along with other commands like tar or xargs to no avail. The problem seems to be with creating the destination directories and folders, where mkdir/cp terminates with an invalid argument response. Cleaning up the source filenames using something like detox isn't viable, as the files are being served by transmission-daemon, and as such the names must be preserved. Permissions are not an issue either, as the same responses occur whether I use a standard or root account. Any ideas would be greatly appreciated, since I'm pretty much out of them at this point. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
Michael Sierchio ku...@tenebras.com writes: I just use tar for this. ( cd /path/to/src ; tar cf - . ) | ( cd /path/to/obj ; tar xf - ) I was going to launch into an explanation of shell quoting, but come to think of it, tar is how I do this too. On Sat, Nov 5, 2011 at 12:47 PM, Chris cpubur...@gmail.com wrote: I'm having difficulty copying a directory tree from my FreeBSD server to USB storage. The problem is that the tree contains file and folder names which have spaces, similar to the following: ./foo bar/some name.tar.gz ./foo bar/child dir/some other name.tar.gz I think: cp foo\ bar/some\ name.tar.gz some_other_path/. will work for all shells. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
The tar one-liner is similar what I used to use on Gentoo and Arch linux, so I thought it strange that it isn't working here. I'm still having problems though, since the command returns Can't create '$FILENAME' for all files found. I quick tested by telling the tar command to copy to /tmp instead, and it worked fine. Copying a few test files created with ee transfer to /mnt/usb fine as well. I'm thinking there may be some characters (or even name length) that are causing the problem. Are there restrictions on filename characters/length on drives mounted with msdosfs? The mount entry for the drive is: /dev/da0s1 on /mnt/usb (msdosfs, local) #with -o longnames ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
Chris cpubur...@gmail.com writes: The tar one-liner is similar what I used to use on Gentoo and Arch linux, so I thought it strange that it isn't working here. I'm still having problems though, since the command returns Can't create '$FILENAME' for all files found. It would have been a good idea to show us the command you used that produced this. Without that, all we can do is say I don't know; it works for me! ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
Oh, and what kind of filesystem is on the USB device? - M On Sat, Nov 5, 2011 at 2:48 PM, Lowell Gilbert freebsd-questions-lo...@be-well.ilk.org wrote: Chris cpubur...@gmail.com writes: The tar one-liner is similar what I used to use on Gentoo and Arch linux, so I thought it strange that it isn't working here. I'm still having problems though, since the command returns Can't create '$FILENAME' for all files found. It would have been a good idea to show us the command you used that produced this. Without that, all we can do is say I don't know; it works for me! ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
Michael Sierchio ku...@tenebras.com writes: Oh, and what kind of filesystem is on the USB device? msdosfs. Sorry; I trimmed that from what I quoted. - Lowell - M On Sat, Nov 5, 2011 at 2:48 PM, Lowell Gilbert freebsd-questions-lo...@be-well.ilk.org wrote: Chris cpubur...@gmail.com writes: The tar one-liner is similar what I used to use on Gentoo and Arch linux, so I thought it strange that it isn't working here. I'm still having problems though, since the command returns Can't create '$FILENAME' for all files found. It would have been a good idea to show us the command you used that produced this. Without that, all we can do is say I don't know; it works for me! ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
I apologize for the lack of detail. The command I'm using is: ( cd /usr/local/etc/transmission/home/Downloads/ ; tar cf - . ) | ( cd /mnt/usb ; tar xf - ) I've also tried: cp -afv /usr/local/etc/transmission/home/Downloads /mnt/usb rsync -aq /usr/local/etc/transmission/home/Downloads /mnt/usb find . -print0 | xargs -0 -I {} cp {} /mnt/usb #when in source directory Filesystem on USB drive is FAT32, 32k blocksize, 16GB capacity, formatted on a Windows 7 box. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
On Sat, Nov 5, 2011 at 3:15 PM, Chris cpubur...@gmail.com wrote: I apologize for the lack of detail. The command I'm using is: ( cd /usr/local/etc/transmission/home/Downloads/ ; tar cf - . ) | ( cd /mnt/usb ; tar xf - ) Show, don't tell. What does tar report when you run it? ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
On Sat, Nov 5, 2011 at 6:20 PM, Michael Sierchio ku...@tenebras.com wrote: On Sat, Nov 5, 2011 at 3:15 PM, Chris cpubur...@gmail.com wrote: I apologize for the lack of detail. The command I'm using is: ( cd /usr/local/etc/transmission/home/Downloads/ ; tar cf - . ) | ( cd /mnt/usb ; tar xf - ) Show, don't tell. What does tar report when you run it? The following messages display: ./: Can't set user=921/group=921 for . ./Reboot S1 - 01 [3FD6C4B2].mkv: Can't create 'Reboot S1 - 01 [3FD6C4B2].mkv' The last message (can't create) repeats for all files in the directory. Running 'ls -al /mnt/usb' yields: drwxr-xr-x 1 rootwheel 32768Dec 31 1979 . drwxr-xr-x 1 rootwheel 512Nov 5 03:04 .. Where /mnt/usb was originally empty in the first place. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: recursive copy with spaces in descendants
On a hunch, I gave the following a shot: tar -cvlf - '/usr/local/etc/transmission/home/Downloads'/ | split -a 2 -b 3900m - /mnt/usb/TX_DL.tar. which created a split tar archive of the files on /mnt/usb. I'm still thinking there's something with the source path/file names that the msdosfs driver on BSD doesn't like, but at least this way is usable for the intended scenario. I guess I'll call this solved unless you all have some insight as to why the original method wasn't working. Thanks for all the help so far! ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org