find and cp with directory structure.

Wes James comptekki at gmail.com
Mon Oct 24 14:43:16 UTC 2011


Hi,

On Mon, Oct 24, 2011 at 4:41 AM, Wipe_Out
<wipe_out at users.sourceforge.net> wrote:
> Hi,
> I am trying to keep a directory with only the files that have changed in the
> last 30 days (nothing earlier).. I am trying this command..
> find /mnt/Scheduling/ -type f -mtime -30 -exec cp -r {}

<snip>

Try this: (not fully tested)

# files 30 days old
tar -vpcf - -C `find src_dir -ctime -30` | tar xpf - -C dest_dir

(dest_dir must exist)

or try this:

http://www.linuxquestions.org/questions/linux-general-1/rsync-files-accessed-under-30-days-379378/

with the above rsync solution, you create a file that contains a list
of your files, then rsync the files in that list.

-wes




More information about the ubuntu-users mailing list