If I run the command mv folder2/*.* folder
, I get "argument list too long" error.
I find some example of ls
and rm
, dealing with this error, using find folder2 -name "*.*"
. But I have trouble applying them to mv
.
Solid-state drives (SSDs) are faster than older HDDs, so you can get an SSD for your machine for faster copying. The same applies when copying from or to an external drive. If you use a flash drive with USB 2.0 or an older external HDD, the transfer speeds will drag.
If we are cutting(moving) within a same disk, then it will be faster than copying because only the file path is modified, actual data is on the disk. If the data is copied from one disk to another, it will be relatively faster than cutting because it is doing only COPY operation.
Step 1: Click on the first file to be selected. Step 2: Hold down Ctrl and click on all the files that you want to select additionally. Step 2: Press the Shift key and click on the last file. Step 3: You have now selected all files at once and can copy and move them.
find folder2 -name '*.*' -exec mv {} folder \;
-exec
runs any command, {}
inserts the filename found, \;
marks the end of the exec command.
The other find
answers work, but are horribly slow for a large number of files, since they execute one command for each file. A much more efficient approach is either to use +
at the end of find
, or use xargs
:
# Using find ... -exec + find folder2 -name '*.*' -exec mv --target-directory=folder '{}' + # Using xargs find folder2 -name '*.*' | xargs mv --target-directory=folder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With