Link to home
Start Free TrialLog in
Avatar of RAH104
RAH104

asked on

Moving Large Number Of Files

Hello,

[root@server base_files]# mv *.jpg *.gif *.png *.bmp /home/fp/public_html/image_files/
-bash: /bin/mv: Argument list too long

There are 10,000+ files in that directory it has to search through.

How do I resolve this?

Thanks.
Avatar of Morcalavin
Morcalavin
Flag of United States of America image

Try this


for i in *.jpg *.gif *png *.bmp;do mv ${i} /home/fp/public_html/image_files/${i};done

Open in new window

You might have to do below if . isn't in your path.

for i in *.jpg *.gif *png *.bmp;do mv ./${i} /home/fp/public_html/image_files/${i};done

Open in new window

Avatar of itsManoj
itsManoj

Or use four simple commands:

mv *.jpg /home/fp/public_html/image_files/
mv *.gif /home/fp/public_html/image_files/
mv *.png /home/fp/public_html/image_files/
mv *.bmp /home/fp/public_html/image_files/

Avatar of RAH104

ASKER

[root@server base_files]# for i in *.jpg *.gif *png *.bmp;do mv ${i} /home/fp/public_html/image_files/${i};done
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: cannot stat `*.bmp': No such file or directory
[root@server base_files]# for i in *.jpg *.gif *png *.bmp;do mv ${i} /home/fp/public_html/image_files/${i};done
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: cannot stat `*.bmp': No such file or directory
[root@server base_files]# mv *.jpg /home/fp/public_html/image_files/
[root@server base_files]# mv *.gif /home/fp/public_html/image_files/
mv: cannot stat `*.gif': No such file or directory
[root@server base_files]# mv *.png /home/fp/public_html/image_files/
mv: cannot stat `*.png': No such file or directory
[root@server base_files]# mv *.bmp /home/fp/public_html/image_files/
mv: cannot stat `*.bmp': No such file or directory
ASKER CERTIFIED SOLUTION
Avatar of Morcalavin
Morcalavin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial