Register
It is currently Sun Nov 23, 2014 6:15 am

Space in directory name


All times are UTC - 6 hours


Post new topic Reply to topic  [ 8 posts ] 
Author Message
 PostPosted: Thu Aug 02, 2012 10:06 am   

Joined: Thu Aug 02, 2012 9:08 am
Posts: 6
I have created some kind of a script that will copy from xdcam card to computer a whole directory, and everything works ok, but
i have create some kind of menu that ask You what number of card is it? So if you put second card to card reader computer give a second card name "Untitled 1" with space so i thought that
Code:
cp -r /Volumes/Untitled\ 1/BPA /Volumes/XsanMedia/EPISODE\ $NAME/XDCAM/DAY1/
will copy whole directory, but it doesn't.
So any help will be appreciated
Thanks in advance


Top
 Profile  
 PostPosted: Thu Aug 02, 2012 10:44 am   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 567
does the command output any error messages?
does it copy anything?
is $NAME defined?


Top
 Profile  
 PostPosted: Thu Aug 02, 2012 11:30 am   

Joined: Thu Aug 02, 2012 9:08 am
Posts: 6
no, there is no error it complete, and $NAME is defined, but wont copy anything.
but the first one card working everything, because it is "Untitled" and not "Untitled 1"


Top
 Profile  
 PostPosted: Thu Aug 02, 2012 11:43 am   

Joined: Thu Aug 02, 2012 9:08 am
Posts: 6
and one interesting thing...
this part of code:
Code:
diskutil eject /Volumes/Untitled\ 1

is working.
It does eject that specific card but copy is not working.


Top
 Profile  
 PostPosted: Thu Aug 02, 2012 2:45 pm   

Joined: Thu Aug 02, 2012 9:08 am
Posts: 6
Ok, I did it....
Code:
cp -r

wont copy directory
Code:
cp -R

copied directory


Top
 Profile  
 PostPosted: Thu Aug 02, 2012 8:01 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 567
strange :(
GNU coreutils' cp's man page says
Quote:
-R, -r, --recursive
copy directories recursively


Top
 Profile  
 PostPosted: Fri Aug 03, 2012 12:53 pm   

Joined: Thu Aug 02, 2012 9:08 am
Posts: 6
I read man page too, but the only way it works is with capitalized R
strange to me too, but ...
Don't know is it because it's not on nix but mac.
So If someone gets stuck on this problem "R" helped me...


Top
 Profile  
 PostPosted: Wed Aug 08, 2012 12:18 pm   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
leveex wrote:
Don't know is it because it's not on nix but mac.

BSD cp(1) wrote:
Historic versions of the cp utility had a -r option. This implementation supports that option; however,
its use is strongly discouraged, as it does not correctly copy special files, symbolic links, or fifo's.



The Open Group wrote:
The -r option is historical practice on BSD and BSD-derived systems.
This option is no longer specified by POSIX.1-2008 but may be present in some implementations.

The -R option was added as a close synonym to the -r option, selected for consistency with all other
options in this volume of POSIX.1-2008 that do recursive directory descent.

The difference between -R and the removed -r option is in the treatment by cp of file types other than
regular and directory. It was implementation-defined how the -R option treated special files to allow both
historical implementations and those that chose to support -r with the same abilities as -R defined by this
volume of POSIX.1-2008.

The original -r flag, for historic reasons, did not handle special files any differently from regular files,
but always read the file and copied its contents. This had obvious problems in the presence of
special file types; for example, character devices, FIFOs, and sockets.


TL;DR: use -R instead of -r if you want a script to be POSIX-compliant.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP