Moving large number of files

find /source/directory -mindepth 1 -maxdepth 1 -name '*' -print0 | xargs -0 mv -t /target/directory;
if you want to move with command mv large list of files than you would get following error /bin/mv: Argument list too long alternavite with exec: find /source/directory -mindepth 1 -maxdepth 1 -name '*' -exec mv {} /target/directory \;
Sample Output

By: aysadk
2020-11-17 12:30:45

What Others Think

use xargs instead of -exec
nordri · 2 weeks and 1 day ago
@nordri command updated, thank you.
aysadk · 2 weeks and 1 day ago
a hit freelancers swear by exercises — washing your face, putting on real garments and placing smartphone boundaries — and those recommendations increase to ingesting. dietary therapist and longtime paintings-from-homer wilma macdonald told huffpost that snacking right here and there's the largest mistake she sees new far flung workers make. she recommends setting up your day like all everyday working day, with a lunch wreck, a few smaller breaks and a focus at the most important meal: breakfast.
webcontentonline · 2 weeks ago [url=][/url]
webcontentonline · 2 weeks ago
System error code 200 means "The code segment cannot be greater than or equal to 64K." This error code may also display as "ERROR_RING2SEG_MUST_BE_MOVABLE" or as the value 0xC8.
brandonisaac · 1 week and 5 days ago
Do you know the methods for moving large number of files in a simple way? If you don’t know the steps then this website details will be helpful for that. Anyway thank you so much for providing this programming language for us bmw auto repair shops
leonamargret · 1 week and 2 days ago
thanks for this man. exactly what i needed.
looneyhans · 1 week and 1 day ago
thanks for this nice article!
Killersmile · 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: