LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


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

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


Hi,
-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
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

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

Have a look at man xargs


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

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
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.
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:07 AM.

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