Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I would like to know how could I move all files from a folder to another folder with a command line.

Let's say I'm in my Downloads folder and there are a 100 files that I would like to move to my Videos folder, without having to write all the files name.

share|improve this question
You're asking about moving files but people showing you how to move not only files but foldersas well. Is that OK? –  oscar Feb 26 at 1:35

5 Answers 5

To do so, Open a terminal and execute this command:

mv  -v ~/Downloads/* ~/Videos/

It will move all the files and folders from Downloads folder to Videos folder.

To Move all files, but not folders:

But, If you are interested to move all files (but not folders) from Downloads folder to Videos folder, use this command

find ~/Downloads/ -type f -print0 | xargs -0 mv -t ~/Videos

To move only files from the Download folders, but not from sub-folders:

If you want to move all files from the Downloads folder, but not any files within folders in the Download folder, use this command:

find ~/Downloads/ -maxdepth 1 -type f -print0 | xargs -0 mv -t ~/Videos

here, -maxdepth option specifies how deep find should try, 1 means, only the directory specified in the find command. You can try using 2, 3 also to test.

See the Ubuntu find manpage for a detailed explanation

share|improve this answer
you can use mv alone to move an entire directory to another folder: mv folder ~/Documents –  JohnMerlino Aug 9 '14 at 22:42
FYI I believe your first command ("mv -v ~/Downloads/* ~/Videos/") won't move dot files. –  Mark Doliner Dec 23 '14 at 6:11
Yes, It won't move the .files –  Anwar Shah Dec 24 '14 at 18:11
Nb. your -print0 | xargs -0 mv -t ~/Videos can be more efficiently done with -exec mv -t ~/Videos \{\} \+ :-) –  artfulrobot Jun 9 at 13:46
yeah, that's true. I was novice then when i answered the question –  Anwar Shah Jun 9 at 13:54
mv ~/Downloads/* ~/Videos

It will move all the files including subfolders in the directory you want to mv. If you want to cp (copy) or rm (remove) you will need the -r (recursive) option to include subfolders.

share|improve this answer
My mv command doesn't have a -R option (Ubuntu 14.04). –  Mark Doliner Dec 23 '14 at 6:10
@MarkDoliner, yes, mv doesn't need recursive option to include subfolders. One can use it also for renaming. –  AliNa Jan 25 at 23:26
  1. Go to the command line and get into the directory you want to move it to with cd folderNamehere
  2. Type pwd. This will print the directory you want to move it too.
  3. Then change to the directory where all of the files are with cd folderNamehere
  4. Now to move all the files type mv *.* typeAnswerFromStep2here

That will move all files from that directory to the other.

share|improve this answer
This will not match files without any extension. for example if a folder has the files: foo.txt, bar. and bar both bar. and bar will not be moved. Using * instead of *.* takes care of that. But in both cases, hidden files like: .foobar will not be moved. –  Dan Sep 12 '13 at 14:20


mv -v ~/rootfolder/branch/* ~/rootfolder

I hope this helps. Because I had the same pain and wasted a lot of time fixing my mistake.

share|improve this answer

It's possible by using rsync, for example:

rsync -vau --delete-after src/ dst/


  • -v, --verbose: increase verbosity
  • -a, --archive: archive mode; equals -rlptgoD (no -H,-A,-X)
  • -u, --update: skip files that are newer on the receiver
  • --delete-after: delete files on the receiving side be done after the transfer has completed

If you've root privileges, prefix with sudo to override potential permission issues.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.