Find the answer to your Linux question:
Results 1 to 3 of 3
I keep the file systems on my desktop and laptop synchronized with each other using rsync. I am constantly concerned about accidentally overwriting files. I've been using Places -> Search ...
  1. #1
    Just Joined!
    Join Date
    Jun 2011
    Posts
    2

    [SOLVED] excluding directories from find command

    I keep the file systems on my desktop and laptop synchronized with each other using rsync. I am constantly concerned about accidentally overwriting files. I've been using Places -> Search for Files... to keep track of new files on the two computers, but I seek a command line solution.

    I've been trying to use an appropriate "find" command. I've discovered

    Code:
    find ~/000files ~/Music ~/Pictures ~/Videos -mtime 0 | xargs /bin/ls -oht | more
    (I need the ls command so that I can view the files in reverse chronological order to compare with the other computer.)

    This method works ok, but it has an annoying glitch. If a regular file was modified in the last day, it's host directory also shows up as a new file. That wouldn't be a big deal except that the ls command lists all that directory's contents as well, not just the new files.

    My preferred solution would be to tell find to ignore *all* directories. My next favorite solution would be to tell ls to ignore all directories. I tried

    Code:
    ls -p | grep -v "\/"
    which I saw at another site. It didn't work. It also didn't work with the -F flag.

    Is there a way to force "find" to ignore all directories upon output?

  2. #2
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,097
    add this to find:
    Code:
    -type f
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Jun 2011
    Posts
    2
    Wow, that easy! Exactly what I wanted. Obviously I'm not proficient with find. Thank you so much.

Posting Permissions

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