Command line problem : SOLVED

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
T J Tulley
Level 5
Level 5
Posts: 558
Joined: Wed Jul 18, 2007 10:18 am
Location: Hull, England

Command line problem : SOLVED

Post by T J Tulley »

I post the command:
theo@TJT4Celena:/$ cp -t /media/sdb3/Documents*and*Settings/Theo*T*/My*Pic*/FujipixE* /media/CORSAIR/Pictures
and get the response:
cp: omitting directory `/media/CORSAIR/Pictures'
which is intended to be the destination. Why? The command is intended to copy the folder FujipixE* into the destination folder Pictures.

I tried adding a directory for the destination, as follows:
theo@TJT4Celena:/$ cp -t /media/sdb3/Documents*and*Settings/Theo*T*/My*Pic*/FujipixE* /media/CORSAIR/Pictures/FujipixE
but the response was similar:
cp: omitting directory `/media/CORSAIR/Pictures/FujipixE'
theo@TJT4Celena:/$

Using Celena with 1GB RAM

I have tried copying manually and get an error message:
Error "Invalid parameters" while copying "/media/sdb...ov 2007 - ".
[The full current name of the source folder 'FujipixE* ' is 'FujipixE - 16 Nov 2007 - ' - it is awaiting a completion date. ]
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Yours hopefully -

Theo Tulley.
Using a PC with 2GB RAM, 3 hdds and a 1.7 GHz Celeron cpu.
Fred

Re: Command line problem

Post by Fred »

T J Tulley,

Without commenting on your specific problem, let me make a suggestion.

Try using rsync instead of cp. It is much faster and more efficient, as well as being a lot more flexible in its' uses. The below link is a good place to start, if you are interested.

http://techgage.com/article/backing_up_your_linux/

Fred

EDIT: If you want a simpler text or GUI interface, try "Unison." It is in the repos.
User avatar
T J Tulley
Level 5
Level 5
Posts: 558
Joined: Wed Jul 18, 2007 10:18 am
Location: Hull, England

Re: Command line problem

Post by T J Tulley »

Thanks Fred: I had already looked at rsync, and now I have printed its Manual - somewhat formidable, and mainly devoted to remote backups. I note the ability to update files - which is what I understand as an incremental backup. However I fear it will be a long time before I've digested enough to be able confidently to use it.

I failed to use even cp in a command line, so back-up by selecting the directory to be backed up, Edit/Select-all, copy the selected files, paste into prepared folder in the remote directory.

The command I was trying to use in my original question was to copy pictures to a USB flash drive, so that I could transfer them to my laptop - in the end I had to do that manually.

IMHO the rsync manual doesn't describe local use enough - I make my back-ups in another internal drive.
Yours hopefully -

Theo Tulley.
Using a PC with 2GB RAM, 3 hdds and a 1.7 GHz Celeron cpu.
Fred

Re: Command line problem

Post by Fred »

T J Tulley,

Here is an rsync command that will create a mirror image of your home folder on /media/sda3/BackUp. Assuming that there is such a folder. The "v" is the verbose option that will allow you to see what is happening. Ordinarily you would not put it in, but for the sake of seeing how it works I did. The "a" preserves the permissions. The "r" is the recursive flag, which includes folders in the back up. The "delete" removes anything from the destination that isn't in the source. For an example, if you had deleted something in your home folder since the last time you backed up.

sudo rsync -avr --delete /home/fred /media/sda3/BackUp

In order for this to work, both the source and the destination must be mounted.

This is a simple example for using rsync. It is a very powerful command and can get complicated if you want to do complicated things.

Fred


PS: I like your willingness to stick with things. I misjudged that in you. I apologize. :-)

EDIT: If you try to apply this command to copying from a usb device to a folder in home for example, be sure to not use the "delete" command, as it will remove everything in the destination folder that isn't in the source folder. Example:

sudo rsync -rv /media/sdb1/pictures /home/fred/My_Pictures
User avatar
T J Tulley
Level 5
Level 5
Posts: 558
Joined: Wed Jul 18, 2007 10:18 am
Location: Hull, England

Re: Command line problem

Post by T J Tulley »

Thanks for a rapid reply, Fred. I should be getting on with other things!

I noticed the description of the Delete option in the rsync manual.

Re: your offered command: Source - /home/fred for me would become /media/sda1/Doc*and*Settings/Theo*Tulley/Theo*T*Doc* because instead of using my home folder I use my old Windows D&S/MyDocs (abbreviated) - which has a comprehensive file structure for all my family, business and various organisational interests.

In everyday use I access it via a symbolic link on my Desktop screen, but I'm a bit wary of using the symbolic link to do a backup - I note this is discussed in the manual.

That omits e-mails which are in /home/theo/.mozilla-thunderbird/ydwjs*/Mail/Local*Folders and tend to get forgotten. The Outlook Express e-mail archive is still in My Docs, but i shall move it to a different folder (in an earlier Windows partition image) where less frequent backups are required - My Pictures lives there too. One of these days I hope to edit the OE6 archive into my Thunderbird Local Folders but it isn't simple.

Destination will be: /media/sdc1/BkpI4M where BkpI4M is a folder created for today's date which is I4M in my private convention. That is a practice which I shall modify using an undated folder if I adopt rsync with its incremental capability.

I shall try it - but not now. Thanks again. BTW, I read the TechGage page you quoted.
Yours hopefully -

Theo Tulley.
Using a PC with 2GB RAM, 3 hdds and a 1.7 GHz Celeron cpu.
miket

Re: Command line problem

Post by miket »

Hi !
T J Tulley wrote:I post the command:
theo@TJT4Celena:/$ cp -t /media/sdb3/Documents*and*Settings/Theo*T*/My*Pic*/FujipixE* /media/CORSAIR/Pictures
and get the response:
cp: omitting directory `/media/CORSAIR/Pictures'
The -t flag is telling cp that the DESTINATION directory is /media/sdb3/Documents*and*Settings/Theo*T*/My*Pic*/FujipixE* and not /media/CORSAIR/Pictures.

Rerun the same command but without the -t flag :

Code: Select all

cp /media/sdb3/Documents*and*Settings/Theo*T*/My*Pic*/FujipixE* /media/CORSAIR/Pictures
The man page for cp gives :

cp [OPTION]... -t DIRECTORY SOURCE ...

Where Directory is the DESTINATION Directory:

-t, --target-directory=DIRECTORY
copy all SOURCE arguments into DIRECTORY

Hope this helps.


Mike.
User avatar
T J Tulley
Level 5
Level 5
Posts: 558
Joined: Wed Jul 18, 2007 10:18 am
Location: Hull, England

Re: Command line problem : SOLVED

Post by T J Tulley »

Thanks a lot Mike. I regard the problem as solved and have said so.

I don't find that line in man cp very intelligible! The manual starts by giving a synopsis of 3 options - I suppose only the second means simply what it says.

That's history now as i did it "manually" in the end. Now I have the task of doing a bulk-rename on 2 folders of pictures with Irfanview in my laptop. I have learned that Irfanwiew will run under Wine in Linux but I'm not yet competent at managing Wine.
Yours hopefully -

Theo Tulley.
Using a PC with 2GB RAM, 3 hdds and a 1.7 GHz Celeron cpu.
Fred

Re: Command line problem : SOLVED

Post by Fred »

AvanceIT,

I didn't take the time to go through that with him because I thought his time would be better spent working with rsync, but I am sure he appreciates your input. Thanks :-)


T J Tulley,

The rsync commands I showed your weren't intended to be applicable to your particular file/partitioning set-up. I know you have a rather complicated setup. They were just intended to show you a practical example of a simple copy and mirror backup rsync command that can be used within a local file system.

Fred

EDIT: I am glad to know that "Irfanwiew" will run under Wine. I didn't know that. Thanks :-)
MagnusB
Level 6
Level 6
Posts: 1252
Joined: Sun Nov 18, 2007 12:39 pm
Location: Norway

Re: Command line problem : SOLVED

Post by MagnusB »

Just another tip, the wildcards just needs to enough to make the path unique, if it is not it will just take the first in line (alphabetically). Also, tab completing is heaven :)
Image
You're not drunk if you can lie on the floor without holding on.
--Dean Martin
Locked

Return to “Beginner Questions”