maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N800 (https://talk.maemo.org/forumdisplay.php?f=25)
-   -   Missing Command "cpio" in OS2008 on N800? (https://talk.maemo.org/showthread.php?t=17804)

saklotz 2008-03-12 06:54

Missing Command "cpio" in OS2008 on N800?
 
I am trying to write a simple file copy command in xterm [find /./media/usb/sda1/dcim -name '*.JPG' | cpio -p /./media/mmc2/images] and received the message "sh: cpio: not found". Typing /bin/busybox without arguments gave me a listing of all command line "commands" available. The command "cpio" was not on the list. Why is the command "cpio" not available in this version of the Nokia IT's operating system (OS2008)? Is it available and am I just missing something or entering the syntax of the file copy command incorrectly?

I have a need to copy specific file types in multiple directories on my camera's CF memory card to a specific directory on my IT's SD memory card. The tablet is set to host mode and I can read all of the media devices correctly. I can list all of the files at /./media/usb/sda1/dcim and at /./media/mmc2/images to see what is in each directory. The "find" command works to list (print) the files that I need from the multiple directories on the CF memory card. I am just getting hung up with the lack of "cpio" in the command set.

Anyone have an idea on how to get the command "cpio" working on my N800 with the latest OS2008? If not, can someone suggest another way to copy the files from multiple directories on the CF memory card to one directory on the SD memory card in the tablet? Preferably without writing an entire shell script and without having to manually select files using File Manager!

Many thanks for your help.

Steve

qwerty12 2008-03-12 07:58

Re: Missing Command "cpio" in OS2008 on N800?
 
If you really want it:
http://repository.maemo.org/pool/mae...-1.3_armel.deb

paulkoan 2008-03-12 08:49

Re: Missing Command "cpio" in OS2008 on N800?
 
What aspect of cpio do you need? The ability to swap cards when full?

If you just need to pass the filenames, you could use xargs and cp

find . -name "*.JPG" -print0 | xargs -0 -i cp {} /media/mmc2/images

Hmm... does the n810 have xargs?

saklotz 2008-03-12 09:48

Re: Missing Command "cpio" in OS2008 on N800?
 
qwerty12 - I am not sure that this .deb binary you suggest will work with the N800 running OS2008. Can you confirm that installing this .deb will not change the existing function of the operating system or any installed applications? If not, I do not want to take the risk.

paulkoan - In my original post, I indicated that I am trying to copy files and not file names. Sorry, but I don't think your suggestion will do the job.

I thank the both of you for your quick replies!

Anyone else like to give a recommended method to my need to copy specified file types (pattern "*.JPG") from multiple directories on an external CF memory card to a single directory on the internal SD memory card? Preferably using one command line statement!

Thanks in advance.

Steve

Duncan 2008-03-12 09:54

Re: Missing Command "cpio" in OS2008 on N800?
 
Quote:

Originally Posted by paulkoan (Post 153877)
What aspect of cpio do you need? The ability to swap cards when full?

If you just need to pass the filenames, you could use xargs and cp

find . -name "*.JPG" -print0 | xargs -0 -i cp {} /media/mmc2/images

Hmm... does the n810 have xargs?

Yes, it has xargs, but busybox xargs doesn't have -0 or -i arguments. This should work though:
Quote:

find -name "*.JPG" | while read foo; do cp $foo /media/mmc2/images; done

flareup 2008-03-12 10:38

Re: Missing Command "cpio" in OS2008 on N800?
 
sorry to butt in here, but I hoped you guys could help with a very simple (almost o topic) q - I'm still having trrouble moving/copying files as in that "themes/screenshot" thread, ie getting the modified background pngs from memory card into themes dir to replace original files.

been using EmelFM2 but getting "denied" result, changed to diff theme, root acces etc.

I'm at very early x term use, so can someone give me the command lines I'd need to copy these across?

cheers!

pipeline 2008-03-12 11:56

Re: Missing Command "cpio" in OS2008 on N800?
 
in xterm :
sudo gainroot
emelfm2

(instead of launching from menu)

if status bar says root and not user you should be able to copy files anywhere

flareup 2008-03-12 12:36

Re: Missing Command "cpio" in OS2008 on N800?
 
thanks very much for that, sorted nicely, cheers!

TA-t3 2008-03-12 12:40

Re: Missing Command "cpio" in OS2008 on N800?
 
Quote:

Originally Posted by saklotz (Post 153861)
I am trying to write a simple file copy command in xterm [find /./media/usb/sda1/dcim -name '*.JPG' | cpio -p /./media/mmc2/images]

What with simply:
Code:

find /media/usb/sda1/dcim -name "*.JPG" -exec cp -p {} /media/mmc2/images/. \;
Or using tar:
Code:

cd media/usb/sda1/dcim  (or into whatever subdir holds the actual ".JPG" files)
tar cf - *.JPG | (cd /media/mmc2/images && tar xvf -)


Duncan 2008-03-12 13:56

Re: Missing Command "cpio" in OS2008 on N800?
 
Quote:

Originally Posted by TA-t3 (Post 153929)
What with simply:
Code:

find /media/usb/sda1/dcim -name "*.JPG" -exec cp -p {} /media/mmc2/images/. \;

Bzzt. Wrong answer. Busybox find doesn't have an exec option.

That was the first solution which occurred to me, but it doesn't work so you need something more complex like the while loop I posted (and tested first) or a tar pipeline.

TA-t3 2008-03-12 14:37

Re: Missing Command "cpio" in OS2008 on N800?
 
I hate busybox more and more.. it shouldn't be trying to cover important functions like 'find'.

Anyway, that 'tar' example I gave will work[1], even with busybox tar. And it's simple.

EDIT: [1] Unless there are enough files to overwhelm the max. argument size (which is btw a problem which will go away, or has gone away already in new linux kernels).

saklotz 2008-03-13 00:06

Re: Missing Command "cpio" in OS2008 on N800?
 
I'll try your suggestions and report results in this thread. Thanks for all of your help.

Regards,

Steve

paulkoan 2008-03-13 00:22

Re: Missing Command "cpio" in OS2008 on N800?
 
Quote:

Originally Posted by saklotz (Post 153888)

paulkoan - In my original post, I indicated that I am trying to copy files and not file names. Sorry, but I don't think your suggestion will do the job.

The busybox limits mean that my suggestion wouldn't work. But I don't get what you meant.

Did you think when I said "pass filenames" I meant that what I was suggesting would only copy the file name and not the actual file?

If so, sorry for being unclear. I meant "pass filenames" to the process doing the actual copying, which would then do the actual copying of the files.

As you are probably aware, "find" will just pass filenames out to the output or can be piped to the next command. Find doesn't actually pass files around.

saklotz 2008-03-13 08:30

Re: Missing Command "cpio" in OS2008 on N800?
 
paulkoan - Sorry, my bad! I was not familiar with "xargs" command. I did think that your solution would copy file names only.

Duncan - Your suggestion did work! Thanks a million! I used [find /media/usb/sda1/dcim -name "*.JPG" | while read foo; do cp $foo /media/mmc2/images; done] and it worked like a charm. I now can get image files from my camera's compact flash memory card copied to the SD memory card on the Nokia IT without having to select and copy files using file manager. I have added the above command line to a script file and can launch it from the osso-statusbar-cpu applet.

Many thanks,

Steve


All times are GMT. The time now is 14:10.

vBulletin® Version 3.8.8