How to copy the previous month files using shell script?
could you please assist the below query.
i had written the below piece of code to copy the files from one directory to another. For current month files had been copied ,unfortunately the previous month files not copied.
Please find the below directory structure:-
ls -lrt
total 1824
drwxrwxrwx 2 root root 1839104 Oct 3 17:14 9
drwxrwxrwx 2 root root 20480 Nov 30 02:25 11----Nov month directory structure.
drwxrwxr-x 2 idcuser idcuser 4096 Dec 4 10:28 12---Dec Month directory strucure
using the below srcript, i can copy only the current month files that only four days of files and other files are not copied .Due to other files were in Nov month.
Hi GUys,
I need to copy the files which are created on particuar month
for eg
ls dir
Jul 12 12:46 apple.txt
Jun 16 15:58 file.txt
i need to copy only files which are created on current month
Please use CODE tags as required by forum rules! (11 Replies)
I am trying to copy files with specific date and name to another folder. I am very new to shell scripting so i am finding it hard to do that. see the sample code i have written below.
srcdir="/media/ubuntu/CA52057F5205720D/Users/st4r8_000/Desktop/office work/26 nov"... (13 Replies)
Hi Experts ,
I have scheduled a script "createstructure "in crontab. The script runs every month on 25th .
I am trying to pass the input to the script as the <year><previousmonth>.For example ,if it is running in the month of March 2014 ,the input should be "201402" (2014-year 02-previous... (7 Replies)
I have requirment to get last date of previous month and the first date of previous 4th month:
Example:
Current date: 20130320 (yyyymmdd)
Last date of previous month: 20130228 (yyyymmdd)
First date of previous 4th month: 20121101 (yyyymmdd)
In my shell --date, -d, -v switches are not... (3 Replies)
Hello,
I'm trying to move the log files from the parent directory to respective monthly folder and I would be running this script on a weekly basis through cron.
I'm new to this scripting and here is what i could come up and it runs without really doing anything. I even tried placing echo... (2 Replies)
Hello
Im new to this forums, I would like some help regarding a script that I need in order to copy some files. Heres the scenario:
I need to search several files which have a particular code inside, lets say "test" all of them on different directories. I need to copy all of them on a new... (4 Replies)
Hi All,
I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this.
My Requirment is as below:
Input for me will be 2000909(YYYYMM)
I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Hi I have a requirement where i have to append the prev month (e.g Feb for current date ) to the file name before sending it for some other processing.
if input file name is
xyz.txt output for the today's run should be xyz_Feb.txt.
i tried this code
1 curmth=`date +%m`
2 mth=(Dec Jan Feb... (1 Reply)
Hi,
My task to to delete files which are of previous months.
I have files named as follows *CCYYMMDD.xls. on a particular day i have delete previous months files
i.e in Dec i have delete all nov files which look like 200511DD.XLS
in Jan i have to delete all Dec files 200512DD.xls
... (7 Replies)