Find the answer to your Linux question:
Results 1 to 2 of 2
Forgive me if this has already been posted. I am trying to move large amounts of files from one directory to the next. The destination directory will contain duplicates. Some ...
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    3

    Compare and move.

    Forgive me if this has already been posted.

    I am trying to move large amounts of files from one directory to the next. The destination directory will contain duplicates. Some of the files may have a different name but be in the same directory. So if a directory exists, I want to be able to skip that directory entirely. However, if there is a directory within a directory that does not exist in the destination, I need that directory and its contents moved accordingly. There are also file types I want to skip. I guess a little like a backup script.

    Example:

    Original dir: /media/hda1/stuff/this/files/thefile

    Destination dir: /media/sda1/differentstuff/this/otherdir/otherfile


    The script will compare the 'stuff' directory and the 'differentstuff' directory. So I would need it to transfer the 'files' directory and it's contents from the 'stuff' to the 'this' directory in 'differentstuff' without skipping due to it being in the 'this' directory.

    I was researching in creating a script using `diff` somehow.

    Is this possible? Has this been done? Any help is appreciated.

    Thanks in advance.

    C

  2. #2
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    452
    welcome to the forum

    have you investigated "tar"? It will let you skip certain files,
    not overwrite certain directories--that's where I'd start.
    the sun is new every day (heraclitus)

Posting Permissions

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