|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Help ! Too many files to mv / cp
Hello,
I have a very large number of files in a directory which i need to move - I'm running Suse Linux. If I try cp or mv or even zip, I'm told that there are too many arguments to process the command.... Any ideas how I can move these? |
|
#2
|
|||
|
|||
|
hi!
you can copy them one after the other like this: Code:
for i in *; do mv "$i" /tmp/`basename $i`; done though it could give you the same error. if so, try this: Code:
find . -exec "mv {$1} /tmp/`basename {$1}`"
where i am not sure about the "{$1}". see "man find" which the parameter for substitution is. be sure to copy all quotes! i am not 100% sure if they all are right, so do some testing with filenames with spaces(!) disclaimer: i take no responsibility if you end up destroying all your data!
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. Last edited by M.Hirsch : May 21st, 2002 at 12:24 PM. |
|
#3
|
|||
|
|||
|
You could also try, from the directory containg your files,
Code:
tar cf - * | (cd /path/to/newdir/ ; tar xfp - ) although i have never tested this for a very large number of files. I don't know what tar's limitations are compared to cp or mv. jaa Last edited by justice41 : May 21st, 2002 at 03:31 PM. |
|
#4
|
|||
|
|||
|
i think the limitation is on the shell or linux kernel itself, not on cp. (but not 100% sure...)
chinook, can you post your results after you tried please? |
|
#5
|
|||
|
|||
|
Yes, you are right.
See here http://www.linuxjournal.com/article.php?sid=6060 for solutions (some of which are in earlier post above) jaa |
|
#6
|
|||
|
|||
|
Hi,
I found this page http://www.linuxjournal.com/article.php?sid=6060 which had a few different methods. The one that I used did actually take quite a long time to mv (5 minutes). I used a function: function large_mv () { while read line1; do mv directory/$line1 ../directory2 done } ls -1 directory/ | large_mv Cheers for the replies! |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Linux Help > Help ! Too many files to mv / cp |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|