Tag Info

Hot answers tagged

74

cp --preserve=links From the man page: --preserve[=ATTR_LIST] preserve the specified attributes (default: mode,owner- ship,timestamps), if possible additional attributes: context, links, xattr, all Personally, I use cp -av for most of my heavy copying. That way, I can preserve everything - even recursively - ...


44

You can use find and cpio to do this cd /top/level/to/copy find . -name '*.txt' | cpio -pdm /path/to/destdir (-updm for overwrite destination content.)


41

Raymond Chen wrote a very nice article about this once. Basically, the dialog is just guessing :). http://blogs.msdn.com/b/oldnewthing/archive/2004/01/06/47937.aspx "Because the copy dialog is just guessing. It can't predict the future, but it is forced to try. And at the very beginning of the copy, when there is very little history to go by, the ...


31

I am going to count to ten, 1....2....3....4 how many dots is it going to take to get to 10? 5.6.7 What about now? Do you take in to account all past dots between numbers and average it, do you only take the last 4 intervals and use that average, do you only look at the last interval? You have the same problem with file transfers. The speed that the file ...


28

It sounds like rsync is definitely what you are after. You do not need to set up an 'rsync server' to copy files from one machine to another. Rsync supports copying files over SFTP (SSH File Transfer) which most linux boxes have enabled already (if not manually disabled). See Lifehacker's Mirror files across systems with rsync for more details: Whether ...


22

Two directories a and b. Both have files in. You are in a directory that contains a and b. cp -r ./a b -r = recursively.


22

Try: cp -ra /backup/olduser/. /home/newuser


20

You can quite easily build your own solution for Windows using autorun.inf and a .bat file. Create a bat file to copy a directory to your usb drive. xcopy /e /y c:\podcasts\*.* .\dir_on_usb_drive Place the bat file on your mp3 player and create an autorun.inf using these instructions Now you should have your own homebuilt solution to your problem but ...


19

In short: the poor algorithms and the jumpy estimation is actually an implementation weakness. Other tools like TeraCopy do a better job. I think it is not worth explaining why their implementation is not good. They will have noticed it and will improve. What is difficult: You have to take into account resource fluctuations (CPU/Network bandwidth/HDD ...


18

It depends on some factors. If you're moving the file on the same drive and partition it will be faster to cut/paste than to copy since it's not actually moving the data. If it's across partition or drive boundries it will always be a copy or copy+erase so the difference is minimal.


17

For single files you can use tee to copy to multiple places: cat <inputfile> | tee <outfile1> <outfile2> > <outfile3> or if you prefer the demoggified version: tee <outfile1> <outfile2> > <outfile3> < <inputfile> Note that as Dennis points out in the comments tee outputs to stdout as well as the ...


17

If the links contain relative paths, then, copying the link will not adjust the relative path. Use readlink, with the switch -f to follow recursively, in order to get the absolute path of the link. For example: ln -s $(readlink -f old/dir/oldlink) new/dir/newlink If preserving the relative paths is what you want, than the option -P of cp, as said by ...


16

There are many ways to copy DVDs and many different programs out there to help with copying DVDs. Since you are using Windows 7 and Windows 7 comes with DVD burning software, I'll show you how to use the software that comes with Windows 7.The steps you took to copy the dvd should have worked. Once you copied all the files to the desktop, put in a blank DVD. ...


16

cp -p does the trick.


15

Maybe your External HDD is formatted as FAT? FAT-formatted drives can't see files larger than 4 GB, you'll have to reformat it as NTFS. The maximum possible size for a file on a FAT32 volume is 4 GB minus 1 byte (232−1 bytes). Video applications, large databases, and some other software easily exceed this limit. Larger files require another formatting ...


14

You can just copy the files inside the directories you mentioned, that is, the virtual harddisk (.vdi) and the xml-based description of the virtual machine. I did this twice, even cross plattform (a XP geust from an OS X host to a Windows XP host, and an Ubuntu guest from a Windows Vista Host to an OS X host) and it worked fine. There may be two issues: ...


14

There's actually a nearly canonical answer by Microsoft's Raymond Chen about this from WAAAAAY back, and there are a few pieces to the puzzle. Because the copy dialog is just guessing. It can't predict the future, but it is forced to try. And at the very beginning of the copy, when there is very little history to go by, the prediction can be really ...


14

Don't put the stick in their computer? Or encrypt the data. But of course you can't access it on their computer then. But whenever the data on your usb stick can be read, it can be copied. If you want to protect yourself against theft of the stick then encryption is the way to go. I recommend portable truecrypt with a file container for this. If you want ...


14

This is normal, you are reading and writing to the same physical disk and it can be even worse if you have a lot of files in a single directory.


14

The reason for this behavior is rather straightforward, and it relates to how files are saved in most Mac OS X applications: Atomically. What happens is that a copy of the file is written to a temporary staging area, and then moved to replace the original file. This, quite naturally, breaks hard links.


13

Just as the man page says, use -P.


13

Also remember that by default cp copy the first directory INTO the second directory if the second exists. For example cp -a a b will copy a INTO b if b exists, i.e. it will create a into b. If it's not what you want, and you want to copy the content of a into b (for example when copying a whole filesystem into a mount point) use: cp -a a/. b as in the ...


13

Most certainly. Disk Utility that comes with OS X is a powerful tool that should be able to handle most (if not all) of your disk management. Here's how to can clone a partition using Disk Utility: Select the partition that you want the clone saved to. On the "Restore" 'tab', drag the partition you want to clone into the "Source" box, and the partition ...


12

Hey, you might want to check out rsync ( http://www.samba.org/ftp/rsync/rsync.html ). It can do a more reliable job and only copy the files that didn't copy the first time: rsync -vza --progress /source/ /destination/ Good luck!


12

This can be done with good old for: for /r C:\Folder %f in (*.png) do @copy "%f" C:\png Nothing fancy.


12

Don't use Explorer. Whether that means using a 3rd party file manager, a copy handler, or the command line is up to you. A copy handler is a shell extension that intercepts any attempts to copy/move files and implements the operations itself. Normally these copy handlers are made to implement features that Explorer doesn't have, like queuing up multiple ...


12

Yes, there is scp or the former rcp or rsync scp -r source_folder user@host.com:destination_folder The command above will copy source_folder to destination_folder in the user's home directory on host.com


11

Assuming the names are all unique, you should be able to use this command (command group really): for /f "tokens=*" %a in ('dir /b /s /a-d') do @copy "%a" "c:\Single-Folder" To clarify - open a Command Prompt and in the root folder of the folder with the sub folders you want to copy, run that command. So, for example, if you want to copy everything in ...


11

Here's the explanation by Raymond Chen, Principal Software Design Engineer at Microsoft: Why does the copy dialog give such horrible estimates? Because the copy dialog is just guessing. It can't predict the future, but it is forced to try. And at the very beginning of the copy, when there is very little history to go by, the prediction can be really ...


10

For Linux: If you don't mind a little Python scripting you could write a daemon that listens to HAL for events and then launches a script once a device of your choice has been plugged in. An example script would look like this: #!/usr/bin/env python # -*- encoding: utf-8 -*- import dbus import dbus.service if getattr(dbus, 'version', (0,0,0)) >= ...



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