Jump to content
  • 0
Sign in to follow this  
Osmario

move multiple files

Question

5 answers to this question

Recommended Posts

  • 0
1 hour ago, Osmario said:

Hello

How can I move multiple files from a directory to another?

Thanks in advance

 

Hi Osmario,

You can move multiple files from a directory to another using the mv command.

 

Moving a single file file1 from dir1/ to dir2/ directory:

$ mv -v dir1/file1 dir2/

 

Moving multiple files ( let's say, file1, file2, file3) from dir1/ to dir2/ directory:

$ mv -v dir1/{file1,file2,file3} dir2/

 

I hope this helps. Wish you all the best.

Shovon

Share this post


Link to post
Share on other sites
  • 0

Mr. Shovon

Thanks for your answer. It really works.

Is there a way to move the files without write their names, one by one? I tried *.*  or * and so on but din't work.

Best regards

Osmario

 

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, Osmario said:

Mr. Shovon

Thanks for your answer. It really works.

Is there a way to move the files without write their names, one by one? I tried *.*  or * and so on but din't work.

Best regards

Osmario

 

You're welcome.

 

If you want to move files of specific type (let's say all the pdf files), you can run the mv command like this.
$ mv -v dir1/*.pdf dir2/

 

If you want to move all the files with the filename starting with abc, then run the mv command as follows:

$ mv -v dir1/abc* dir2/

 

You can move the whole directory as follows:

$ mv -v dir1 dir2

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...