LinuxQuestions.org
Help answer threads with 0 replies.
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, 10: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, 10:41 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

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

Have a look at man xargs


Cheers,
Tink
 
Old 07-28-2004, 12:19 AM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
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


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 10:14 AM
argument list to long for linux commands supersucker Linux - Newbie 1 05-10-2005 08:36 AM
bash: /bin/rm: Argument list too long? FiveFlat Linux - General 5 08-12-2004 12:29 AM
Argument list too long trutnev Linux - General 3 04-22-2004 05:32 PM
/bin/rm: Argument list too long dragon49 Linux - Software 1 09-02-2003 01:27 PM


All times are GMT -5. The time now is 02:48 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration