How to delete the files from local host to remote host

Hi all,

i am copying .gz files from production server to development server using
"scp" command.my requirement is after copying .gz files i want to delete old
.gz files(two days back) in development server from production server.

like this way i need to delelte .log ,.z and .dmp files in development server from production server.

Please let me know if you have any concerns.

could you please help me. i really appriciated.

Regards
Admin

Using SSH,

1) Prints the files modified in your local server,

 ssh -l username localhost "find /dir-path -name '*.gz' -o -name '*.dmp' -o -name '*.z' -mtime +2 -print "

2) Add command to remove them,

 ssh -l username localhost "find /dir-path -name '*.gz' -o -name '*.dmp' -o -name '*.z' -mtime +2 -ok rm {} "

or

ssh -l user localhost "find /home/inangan -name '*.gz' -o -name '*.dmp' -o -name '*.log' -mtime +2 | xargs rm -i"

Here mtime +2 signifies the files that are not modified within last 48 hours.

Similary You can also give a try to rsh.

Please let us know if this works.

Thanks,
Nagarajan Ganesan.

Thanks alot Nagarajan Ganesan,

one more doubt: shall i delete the files (which are existing already) in develop ment server from production only.

i donot go to development server and delete the files.so i want this whole process is done from production server to development server only.

thanks advance for understanding

regards
krishna

Yes, you can use rm command in find along with exec or xargs as mentioned in my previous post.Please check the point 2. Also make sure your deleting the correct files in your server.

Thanks,
Nagarajan Ganesan.