Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
I want to list all file that is not modify in last two month my command is find ! [-mtime -60 -type f} | xargs ls -tg but give me ...
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Posts
    31

    list files not modify in last two month but give wrong result?!

    I want to list all file that is not modify in last two month

    my command is
    find ! [-mtime -60 -type f} | xargs ls -tg


    but give me wrong result with this error message

    find: paths must precede expression
    Usage: find [path...] [expression]

  2. #2
    Linux Enthusiast
    Join Date
    Jul 2005
    Location
    Maryland
    Posts
    521
    try this:
    Code:
    find / ! -mtime -60 -type f | xargs ls -tg > files_list
    more files_list
    Edit: the above will list most of the files on the system.
    If you want to list files in a directory (and subdirectories), then do it this way:

    Code:
    cd directory
    find ./ ! -mtime -60 -type f | xargs ls -tg > files_list
    more files_list

  3. #3
    Just Joined!
    Join Date
    Jul 2007
    Posts
    31

    It does not work

    for first code

    find / ! -mtime -60 -type f | xargs ls -tg > files_list
    more files_list


    give me this errore message
    Permission denied

    for second code
    cd directory
    find ./ ! -mtime -60 -type f | xargs ls -tg > files_list
    more files_list


    give me this errore message
    Document: No such file or directory

  4. #4
    Linux Enthusiast
    Join Date
    Jul 2005
    Location
    Maryland
    Posts
    521
    Quote Originally Posted by alivip View Post
    for first code
    ... permission denied
    you need to run it as root.

    for second code
    ... Document: No such file or directory
    I was referring to any directory with files in it.
    Try this:
    Code:
    cd
    find ./ ! -mtime -60 -type f | xargs ls -tg > files_list
    more files_list
    P.S. run every line in the code separately.

  5. #5
    Just Joined!
    Join Date
    Jul 2007
    Posts
    31
    I do this
    Quote Originally Posted by pavlo_7 View Post
    you need to run it as root.


    I was referring to any directory with files in it.
    Try this:
    Code:
    cd
    find ./ ! -mtime -60 -type f | xargs ls -tg > files_list
    more files_list
    P.S. run every line in the code separately.
    same result

  6. #6
    Just Joined!
    Join Date
    Jul 2007
    Posts
    31

    same result

    Ido this

    1
    Quote Originally Posted by pavlo_7 View Post
    you need to run it as root.


    I was referring to any directory with files in it.
    Try this:
    Code:
    cd
    find ./ ! -mtime -60 -type f | xargs ls -tg > files_list
    more files_list
    P.S. run every line in the code separately.
    same result

  7. #7
    Linux Enthusiast
    Join Date
    Jul 2005
    Location
    Maryland
    Posts
    521
    What is your OS? I just tested it on Debian, and it works fine.

  8. #8
    Linux Enthusiast
    Join Date
    Jul 2005
    Location
    Maryland
    Posts
    521
    Also, to run it as root, type:
    Code:
    su
    and then the rest of the commands.

  9. #9
    Linux Enthusiast
    Join Date
    Jul 2005
    Location
    Maryland
    Posts
    521
    you can also create a file with the date you are interested in, and then run "find" command to search for files that were created before the date of that file. For example, create file 111 with the date 2007-06-05 00:00 and then run "find" command:
    Code:
    touch 111 -t 200706050000
    find ./ ! -newer 111 | xargs ls -tg > files_list
    more files_list
    Edit: I meant "... search for files that were created no later than the date of that file".

  10. #10
    Just Joined!
    Join Date
    Jul 2007
    Posts
    31

    thanks for trying help but

    Quote Originally Posted by pavlo_7 View Post
    What is your OS? I just tested it on Debian, and it works fine.
    I use linux fedora 4

    ther is a new error
    lnx5e095-91 HRDH ->% find ./ ! -newer 111 | xargs ls -tg > files_list
    xargs: unmatched single quote

Page 1 of 2 1 2 LastLast

Posting Permissions

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