Find the answer to your Linux question:
Results 1 to 3 of 3
I would like to know how to move all the files from a single folder and its subfolders to a single, different location in as few steps as possible. For ...
  1. #1
    Just Joined!
    Join Date
    Sep 2010
    Location
    Ohio
    Posts
    12

    How to move files from folder/subfolders to a different directory?

    I would like to know how to move all the files from a single folder and its subfolders to a single, different location in as few steps as possible. For example when I download files from one of my school's websites, the file I want is located in a deep sub-directory. So, I have to cd many times just to get to the file I want. Is there a way to recursively move all the files within a folder's subdirectories into a new location? Thanks in advance for the help!

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695
    Google: find exec examples

    Code:
    find /Existing_folder -name "*" -exec cp "{}" /New_Location \;
    ** Any files with the same name will get overwritten by the last version of the file.

  3. #3
    Just Joined!
    Join Date
    Sep 2010
    Location
    Ohio
    Posts
    12
    Thank you very much. That worked great!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...