copy or listing problem
    Henrik W Lund 
    henrik.w.lund at broadpark.no
       
    Fri Jun 18 04:24:09 PDT 2004
    
    
  
Yavuz Maşlak wrote:
> Hello
> I use freebsd4.9
> I have thousands of files in my any directory. and I need to copy them to another directory. 
> but when I started to copy them I got error as below;
> /bin/cp: Argument list too long.
> 
> Do I have to copy them in pieces ?
> 
> What shall I do ?
> 
> Thanks 
Greetings!
You could do it with a shell script:
[SOF]
#!/bin/sh
for file in *
do
	if [ -f "$file" ]
	then
		cp "$file" "$target_dir" #Define $target_dir yourself
	fi
done
[EOF]
This will only do files, not directories or other special files. If you 
want to copy directories as well, the script will quickly grow bigger.
Read man sh for more (maybe even too much) info on how to do anything 
with scripts.
-Henrik W Lund
    
    
More information about the freebsd-questions
mailing list