Posted this at linuxforums.org, figured I'd cross post it here since you guys tend to answer quicker.
I have a directory on a text only machine that is 17GB that I have to transfer over to another machine. Unfortunately all I have to do it with is a 2GB flash drive. There's one subdirectory inside this directory that is 16GB, so if I could copy all the files/directories except this one it'd make it a lot easier(I could then go through and get only what I needed from it.
So if I've got a directory named "top" and it has ~100 files and ~20 sub directories, one of named "data" that is 16GB. How would I go about copying everything but "data"?
Kind of like this:
if that makes any sense.Code:cp -r top -omit /data /mnt/usb/destination
Thanks!
-
-
wearetheborg Notebook Virtuoso
Why not just move the huge directory outside, and then copy the original directory
Something like:
Code:mv top/data . cp -R top mnt/usb/destination
-
The directories in question are in active use, so I need to keep file structure in place.
I went ahead and copied all the files via cp *.*, then copied each directory separately. It was a bit of a pain but it's done with.
I'm still really interested to know if there's a somewhat simple way of doing this, though. -
I haven't tested this, but I'd probably do something with a bash one-liner (assuming there no filenames or directories inside top/ with spaces):
Code:for f in $(find top -maxdepth 1 -name '*'|grep -v '/data'); do echo cp -av "$f" /mnt/usb/destination/; done
-
wearetheborg Notebook Virtuoso
If you are not do know shell scripting, then the following (ugly soln) will work:
Code:cd /mnt/usb/destination mkdir data chmod 000 data cp -R xyz/top/* . chmod 700 data rmdir data
But it will work
EDIT: the following might be better:
Create a file called data in /mnt/usb/destination, then do the recursive copy. Copy will say it cant overwrite a file with a directory, so it wont access the 16GB of data
Copy recursively, omit one subdirectory
Discussion in 'Linux Compatibility and Software' started by system_159, May 22, 2008.