LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to copy a directory (local) from terminal with progress bar showing (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-copy-a-directory-local-from-terminal-with-progress-bar-showing-827200/)

Linux.Girl 08-19-2010 07:44 AM

how to copy a directory (local) from terminal with progress bar showing
 
Hello everyone,

I am new both here and in Linux. As the subject says, I would like to learn how to copy a directory (not a file) from terminal with progress bar showing. The copy is local, i.e., not to another computer.

My distro is CentOS 5.5.

I know that if I do it with nautilus I would see the progress, but I want to learn how to do it from the terminal.

I know that PV command can show a progress bar, but from what I saw, it works well for files, but not for directories (recursive). Is it possible to use PV for directories? If yes, could you please show me the syntax?

I also saw that some people mentioned that rsync can also show a progress bar, I tried to do it, but it didn't work out - perhaps I got the syntax wrong. If rsync can really be used to copy directories with progress bar, could you please show me the syntax?

Any other ideas on how to do it? I would like ideas that do not involve using any script, i.e., just something that I can do using the regular commands.

Many thanks in advance.

Linux.Girl

sem007 08-19-2010 08:16 AM

look at here

http://www.linuxquestions.org/questi...ss-bar-407381/

Linux.Girl 08-19-2010 08:28 AM

Thanks sem007. I saw this thread before, but it didn't help me.

As I mentioned in my question, I do not want to use a script, I want to use the regular commands available.

The thread also mentions PV and rsync, but without much detail. I am very very new and I need someone to show me the exact syntax to copy a directory (localy) using PV. I still don't understand well enough what rsync does and how does it work, hence the PV preference.

Still, thanks for trying to help.

Linux.Girl

quanta 08-19-2010 09:43 AM

Just as a trick, you can use scp with @localhost:
Code:

scp -r <source> user@localhost:<target>
or rsync with --progress parameter:
Code:

rsync -rvh --progress...

Linux.Girl 08-19-2010 09:47 AM

Thanks quanta - wow!

Another quick question, if you don't mind: Can you please explain to me what the "user@localhost" means in the scp example that you gave? i.e., why the syntax is

scp -r <source> user@localhost:<target>

as opposed to

scp -r <source> <target>

Sorry, I'm a newbie!

Thanks a lot!

Linux.Girl

quanta 08-19-2010 09:59 AM

Quote:

Originally Posted by Linux.Girl (Post 4071316)
Can you please explain to me what the "user@localhost" means in the scp example that you gave? i.e., why the syntax is

scp -r <source> user@localhost:<target>

as opposed to

scp -r <source> <target>

scp is often used to copy file to remote host. Here, you can use @localhost as a trick to copy on local. user is `whoami`

Linux.Girl 08-19-2010 10:00 AM

ahhh, ok, no, I don't need to copy it to a remote host, just locally in my computer. So I guess rsync would be the best option (to copy directory locally with progress bar)?

Thanks agains!


All times are GMT -5. The time now is 12:38 AM.