Delete all instances of a particular file in that month

Hi

I need to move one file from source path to target path .Before moving , I need to go to target path and delete the files having certain naming convention in that particular month . So at any point of time while moving i should have only one file . Is there any command that can do this if so can you please let me know .

Thanks

[LEFT]hi Hypesslearner,
Can you please share some input and desire outputs also please refer some example naming convention you are using ?
[/LEFT]

Any attempts from your side? Where are you stuck?

Hi

Here is the example and what i have tried

I have files getting copied everyday like below

Bkp_20151123160720.tar.gz
Bkp_20151122160720.tar.gz
Bkp_20151121160720.tar.gz
Bkp_20151120160720.tar.gz

When I m copying this todays file Bkp_20151123160720.tar.gz, files of older dates of 3 days should be removed

I tried below

find Bkp_20151123160720.tar.gz -mtime -3 -exec rm {} \;

wherein I hardcoded the file name which shouldnt be the case .

Not sure I understand. You need two commands to remove and copy.
For find , you'll need a starting directory. Try

find /target/path -name "Bkp_*160720.tar.gz" -mtime +3 -exec rm {} \;
cp /source/path/Bkp_*.tar.gz /target/path