XCopy on server?

2

Normally, on my website, files are either handled by WordPress or by me doing FTP.

I'd like to copy my entire site to a new folder. I don't want to copy it down to my local drive (with wget) and then just upload it. How close is this to the line I'd need (except near midnight)

 mv -r \fromfolder  \%todaysdate%

I've played with Unix and Linux for a few days over the years, but I'm a Windows (and DOS-prompt) guy. So, I don't know how to get to the server's command prompt on my 1and1-hosted site.

TIA

Robert Frank

Posted 2010-11-19T19:16:35.023

Reputation: 123

It's going to be difficult if you can't get to the server's command line... – Ignacio Vazquez-Abrams – 2010-11-19T19:19:03.767

That's part of my question. How does one get to the command line remotely on a Linux server hosted by 1and1.com. – Robert Frank – 2010-11-19T19:30:08.220

Ok, I've figured how to login with putty to get a Debian prompt. So now the only question is what the mv command to copy a folder and subfolders to a new folder that has the time-date as part of its name. – Robert Frank – 2010-11-19T19:53:32.577

Answers

2

In your control center you should have a part where you can configure access. Among these options, there is FTP and also SSH. Configure SSH access, and log in. If you come via Windows, you have to have a SSH client. Putty is pretty much standard.

In your shell session, you've logged in to your home directory. Your move command is almost right, but you should use a path relative to your home (leave the initial slash away) and use forward slashes / instead of backslashes \. If you want to automatically generate a directory name with a date, you have to look into the basics of shell programming.

Experiment with this: mkdir "`date`" (that are quotes and backticks) and mv -r path/to/fromfolder path/to/tofolder

EDIT: Commenters are right, it should be noted that the date command between the backticks gets executed. Anything between the backticks will be executed and if it produces output, it will land there. And (of course), you should familiarize with the commands you use, for that (depending on how the host is configured) try: man date, info date and/or apropos date (and so on)

knitti

Posted 2010-11-19T19:16:35.023

Reputation: 871

2It should be noted that backticks tell the shell to execute the commands in the backticks first, and then use the output in the commands place. – Christoffer Madsen – 2010-11-19T20:41:47.927

1@Robert: Also, note that mv (no -r) will move the directory. If you want to copy it, use cp -a. – Gilles 'SO- stop being evil' – 2010-11-19T20:54:05.357