Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 07-27-2004, 09:37 PM   #1
Registered: Sep 2003
Location: India
Distribution: redhat linux 9.0
Posts: 46

Rep: Reputation: 15
-bash: /bin/mv: Argument list too long

-bash: /bin/mv: Argument list too long
I got the above error while trying to move 3500 files from one directory to another directory.Is there any way to increase the value of the argument for /bin/mv..

All Suggestions are welcome.
Old 07-27-2004, 09:41 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Depends on what/how you're moving ....

Have a look at man xargs

Old 07-27-2004, 11:19 PM   #3
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
No, I don't believe you can change the number of arguments mv will take. More than likely, it's a restriction on how long a command for your shell can be. Regardless, it's more effort than it's worth, and there are plenty of alternatives.

Like Tinkster said, you can use xargs. To be honest, I never quite got the hang of xargs and I'll let Tinkster field any questions about it

The find command is also very useful in situations like this. I assume you used a wildcard for your mv command, right? (Geez, I'd hate to think you typed over 3,000+ filenames by hand... even with tab-completion). You could use this command:

first, cd into the directory with the files
find . -maxdepth 1 -name "your_wildcard" -exec mv {} /path/to/destination/dir \;

You could also write a very simple shell script, issue multiple mv commands with more restrictive wildcards so that the mv command isn't overwhelmed, and a number of others.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
cp lots of files argument list too long dtra Linux - Software 4 07-07-2005 09:14 AM
argument list to long for linux commands supersucker Linux - Newbie 1 05-10-2005 07:36 AM
bash: /bin/rm: Argument list too long? FiveFlat Linux - General 5 08-11-2004 11:29 PM
Argument list too long trutnev Linux - General 3 04-22-2004 04:32 PM
/bin/rm: Argument list too long dragon49 Linux - Software 1 09-02-2003 12:27 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration