Find and copy files modified today - Aix

This is a discussion on Find and copy files modified today - Aix ; Hello, I am trying to find and copy files modified today from one directory to another. Something like: cp find /dir1/P*.DAT -type f -mtime -1 /dir2/ Is there a way to combine the cp and find commands on a single ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Find and copy files modified today

  1. Find and copy files modified today

    Hello,

    I am trying to find and copy files modified today from one directory
    to another. Something like:

    cp find /dir1/P*.DAT -type f -mtime -1 /dir2/

    Is there a way to combine the cp and find commands on a single line?
    I don't think that there is, so instead I made a script to do this:

    #!/bin/ksh
    PATH1=find /dir1/P*.DAT -type f -mtime -1
    PATH2=/dir2/
    cp $PATH1 $PATH2

    The individual lines do work, but when I try to run this as a script,
    I get "/dir1/PTEST.DAT: This: not found." when it tries to do the
    copy. I know I'm missing something obvious, but at this point google
    has failed me...


  2. Re: Find and copy files modified today

    find /oneplace -type f -mtime -1 -exec cp {} /anotherplace \;

    -Mike "hope you get an A... "

+ Reply to Thread