Tag Info

Hot answers tagged

30

The switch you need is --parents eg: jim@prometheus:~$ cp --parents test/1/.moo test2/ jim@prometheus:~$ ls -la test2/ total 42 drwxr-xr-x 3 jim jim 72 2010-09-14 09:32 . drwxr-xr-x 356 jim jim 43136 2010-09-14 09:32 .. drwxr-xr-x 3 jim jim 72 2010-09-14 09:32 test jim@prometheus:~$ ls -la test2/test/1/.moo -rw-r--r-- 1 jim jim 0 2010-09-14 09:32 ...


21

Execute: alias cp and see if cp has been aliased to "cp -i" In that case run: \cp -r /usr/share/drupal-update/* /usr/share/drupal to ignore the alias


21

To be real down and dirty you can use netcat. On the sender cat {filename} | nc -l 3333 On the receiver nc {sender_ip_address} 3333 > {filename} Since there will be nearly no application overhead, you should only be limited by IO, whether disk or network.


19

You could run rsync with the -W switch, which will disable the checksums.


17

Maybe your cp command is an alias? Try: \cp -uf file folder/


13

Using -t (preserve timestamps) and --size-only will only compare files on size. If the size matches, rsync will not copy the file but since -t is specified, it will update the timestamp on the destination file without recopying it. Make sure to not use -u (update) as this will skip files that already exist and completely skip updating the timestamp. I had ...


12

Couple of quick thoughts: Add in a mkdir -p $(dirname FILE) Could you use a tar pipe to sort it all out? Edit tar -cf archive.tar `svn status -q | awk '{print $2}'` Should create an archive of the modified files. Then: tar -xf archive.tar -C /tmp/xen should put it where you want. If it needs to be in one step, that's possible too.


11

Rsync supports using ssh as a transport rsync -az /path/to/source username@host:/path/to/destination some older versions of rsync require you to specify ssh explicitly rsync -aze ssh /path/to/source host:/path/to/destination An alternative to using rsync is B. C. Pierce's Unison, which has similar functionality to rsync, but keeps a local index at both ...


11

Copying is very simple for MyISAM and completely 100% risky (near suicidal) with InnoDB. From your question, you brought up cp /db1/mytable.frm /db2/mytable.frm MyISAM This is OK to do. However, you cannot just move the .frm. You must move all components. From you question, let's take a table called db1.mytable. In a normal installation, the table is ...


10

Almost every time this can be solved just with: cp -R .[a-zA-Z0-9]* directory It's pretty unusual to have a hidden file that doesn't start with one of those characters. Other pattern matches are available (.??*, .[^.]*) - see the comments


10

My favorite to move dirs in general has been: tar cvf - . | (cd /dest/dir; tar xvf -) which tars up the current directory to stdout then pipes it to a subshell that first cd's to the destination directory before untarring stdin. Simple, direct, extensible - consider what happens when you replace the () with an ssh to another machine. Or to answer your ...


10

If you have the source and dest, you can synchronize your permissions with rsync -ar --perms source/ dest It will not transfer the data, just permissions...


10

I just learned a new and simple way to accomplish this: getfacl -R /path/to/source > /root/perms.ac This will generate a list with all permissions and ownerships. Then go to one level above the destination and restore the permissions with setfacl --restore=/root/perms.acl The reason you have to be one level above is that all paths in perms.acl are ...


10

yep, rsync outside oddball, the async features DRBD came out with recently.


9

One thing you could do is use the find command to build a script with the commands you need to copy the permissions. Here is a quick example, you could do a lot more with the various printf options, including get the owner, group id, and so on. $ find /var/log -type d -printf "chmod %m %p \n" > reset_perms $ cat reset_perms chmod 755 /var/log chmod 755 ...


9

Consider the two scenarios: Copy requires that you read the full file from disk and write it to the disk Tar-Gzip requires that you read a smaller file from disk, decompress, and write it to disk. If your CPU is not being taxed by the decompression process, it stands to reason that the I/O operations are limiting. By that argument (and since you have to ...


8

Rsync can be confusing about selective copies like this. I use the following to do the task that you're asking for: rsync -avP \ --filter='+ */' \ --filter='+ **/*.html' \ --filter='- *' \ --prune-empty-dirs \ --delete \ /source/ \ /dest/ Basically you need to include all directories in the search, then add all *.html files to the list, the exclude all ...


8

I implore you, step away from plain shell expansion on the cp command line - shell expansion has all sorts of ahem "interesting" corner cases (unwanted recursion caused by . and .., spaces, non-printable stuff, hardlinks, symbolic links, and so on.) Use find instead (it comes in the findutils package, in case you don't have it installed - which would be ...


8

If we had to avoid the command line always, we would never have made it to the moon. Either get another astronaut or train harder. If you are talking about a live database in production, the values could be in flux, so it would be unreliable to do backups of a database, in any database type, by simply copying a bunch of files. You can get a safe backup of ...


7

I've always used .??* to find hidden files without getting "." and "..". It might miss ".a" or something, though, but I never have one of those.


7

I would try the Copy Database Wizard command available through SQL Management Studio. This can be done without RDP access. Microsoft also has an MSDN page on copying data between servers that may be helpful.


7

We are using SyncBack, which has lots of good features in all versions: free, SE and PRO version: synchronization or backup over network shares or FTP, ZIP, filters, HTML and email logs, scheduling etc. We use both commercial and free versions on ours servers for web application deployment/synchronization, log file transfers and backup-to-disk jobs.


7

The least-overhad solution would be using netcat: destination$ nc -l -p 12345 > /path/destinationfile source$ cat /path/sourcfile | nc desti.nation.ip.address 12345 (some netcat version do not need the "-p" flag for port) All this does is send the unencrypted data, unauthenticated over the network from one pc to the other. Of course it is not the most ...


7

This problem can be solved with rsync. At least this solution should be competitive in terms of performance. First, rsync can be called from one of the remote systems to overcome the limitation in the inability to copy between two remote systems directly. Second, encryption/decryption can be avoided by running rsync in Daemon Access mode instead of Remote ...


7

Very close: cp P10802{75..83}.JPG ~/Images


7

It depends on how your network is laid out and where the bottlenecks are, but yes, it can be faster to use BitTorrent. In theory, instead of sending out 7 copies of the same files, your source server should only need to send out 1 copy, split among the receivers. By the time that happens, the remaining peers will have shared the parts they didn't receive ...


6

These are the files you would usually need to copy: /etc/passwd /etc/shadow /etc/group /etc/gshadow /home/$USER /var/mail/$USER /var/spool/cron/crontabs/$USER


6

Two choices besides the rsync bandwidth limitation: ionice -c 3 cp foo bar buffer -u 150 -m 16m -s 100m -p 75 -i foo -o bar ionice will interface with the I/O scheduler. buffer is a circular buffer meant to aid character devices in being more efficient, but the -u 150 will pause 150 microseconds between writes which, according to the manual, may be ...


6

ROBOCOPY is included in Windows and displays progress information.



Only top voted, non community-wiki answers of a minimum length are eligible