Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
AdrianQuartx
Posts: 105
Registered: ‎09-06-2013
My Device: Z10
Accepted Solution

Tar utltilty - C not working [Cannot open file O_O]

I tried using the system() C function to tar a directory (/shared/documents) but error saying cannot open file

 

I have shared permissions and it works if i use cp inside system()

Please use plain text.
Contributor
casantos
Posts: 33
Registered: ‎01-13-2013
My Device: BlackBerry Z10, Q10

Re: Tar utltilty - C not working [Cannot open file O_O]

Can you do this at the shell prompt?

 

    tar -c -f /accounts/1000/shared/documents/test.tar /accounts/1000/shared/camera

 

You can start a shell by running the command below (tested on Linux; Mac or Windows may be a little different)

 

    ssh -i ~/.rim/bbt_id_rsa devuser@169.254.0.1

 

 

Please use plain text.
Developer
AdrianQuartx
Posts: 105
Registered: ‎09-06-2013
My Device: Z10

Re: Tar utltilty - C not working [Cannot open file O_O]

Seems to work in ssh

Please use plain text.
Developer
AdrianQuartx
Posts: 105
Registered: ‎09-06-2013
My Device: Z10

Re: Tar utltilty - C not working [Cannot open file O_O]

Hey got it working, i was using the -C switch but it doesnt seem to work, the absolute path works, have my like and thanks :smileyvery-happy: Marked as solved :smileyvery-happy:

Please use plain text.
Contributor
casantos
Posts: 33
Registered: ‎01-13-2013
My Device: BlackBerry Z10, Q10

Re: Tar utltilty - C not working [Cannot open file O_O]

The -C (capital) option has a dfferent meaning. Use

 

   tar --help

 

for a quick list of optins or "man tar" on a Linux box for the full mnual, also available online in many places, like here.

Please use plain text.
Developer
AdrianQuartx
Posts: 105
Registered: ‎09-06-2013
My Device: Z10

Re: Tar utltilty - C not working [Cannot open file O_O]

[ Edited ]

Currently im getting the exact folder structure in the tar file

 

test.tar

----accounts

----------1000

-----------------shared

--------------------------camera

-------------------------------------subdir

-------------------------------------camerafile1

what if i just want the files and subdirs under the camera folder? I tried using -C like

 

tar -cf /accounts/1000/shared/misc/test.tar -C /accounts/1000/shared/camera .

 

and i got 

 

test.tar

---- . 

--------subdir

--------camerafile1

is there a way to get

 

test.tar

----subdir

----camerafile1

 

instead?

 

EDIT

Oh seems like the dot stands for root, my fault

Please use plain text.
Contributor
casantos
Posts: 33
Registered: ‎01-13-2013
My Device: BlackBerry Z10, Q10

Re: Tar utltilty - C not working [Cannot open file O_O]

Dot stands for "current directory". Remember that the underlying OS of BB10 is QNX, which uses Unix-like filesystem structure and semantics.

Please use plain text.