Listing files added in a particular month


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Listing files added in a particular month
# 1  
Old 02-11-2012
Question Working on Linux Terminal

how can I ouput all files in working directory added in a particular month using shellscript

Last edited by Scott; 02-12-2012 at 09:05 AM.. Reason: Restored post
# 2  
Old 02-11-2012
Paste the output of ls -l
Which is your OS?

--ahamed
This User Gave Thanks to ahamed101 For This Post:
# 3  
Old 02-11-2012
thanks

Last edited by mohit_iitk; 02-12-2012 at 01:09 AM..
# 4  
Old 02-11-2012
If you are using Linux, you can use 'ls -l --time-style=+%b'

Below code print out only files

Code:
#! /bin/sh

if [ $# -ne 1 ]; then
  echo "Usage: $0 <month>"
  echo "        month - Jan, Feb, ... Nov, Dec"
  exit 1
fi

ls -l --time-style=+%b | awk -v month="$1" '$6==month && /^-/ { print $7 }'

This User Gave Thanks to chihung For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to copy the two most recently added files to another directory - HP-UX?

Hello, I am attempting to find and copy the two most recently added files to a specific directory, that fit a specific format. I was able to find the command to list the two most recently added files in directory: ls -1t | head -n 2 The command lists the two files names in a vertical list,... (11 Replies)
Discussion started by: mattkoz
11 Replies

2. Shell Programming and Scripting

How to select all files added to a directory in the past 5 mins (HP-UX)?

Hey everyone, I need to select all files that were added to a specific directory in the past 5 mins and copy them over to a different directory. I am using HP-UX OS which does not have support for amin, cmin, and mmin. B/c of this, I am creating a temp file and will use the find -newer command... (7 Replies)
Discussion started by: mattkoz
7 Replies

3. Shell Programming and Scripting

Need last month files after 10th of every month

Hi, I need all file names in a folder which has date >= 10th of last month, Example : files in folder AUTO_F1_20140610.TXT BUTO_F1_20140616.TXT CUTO_F1_20140603.TXT FA_AUTO_06012014.TXT LA_AUTO_06112014.TXT MA_AUTO_06212014.TXT ZA_AUTO_06232014.TXT Output: AUTO_F1_20140610.TXT... (9 Replies)
Discussion started by: nani1984
9 Replies

4. Shell Programming and Scripting

Get out of only Modified and Added files in svn log

How to get only modified and added files with revision,author and comments from svn log verbose ------------------------------------------------------------------------ r7351 | user01 | 2013-07-02 17:53:28 -0400 (Tue, 02 Jul 2013) | 2 lines Changed paths: D /trunk/demo/proj1/.project ... (1 Reply)
Discussion started by: iaav
1 Replies

5. UNIX for Dummies Questions & Answers

Merge files with file names added

I want to merge several files with identical format: file 1: rs3094315 0.0006105222804 0.9528743638 rs3131972 -0.05461465109 0.3139864854 rs3115860 -0.06041530955 0.3195499498 file 2: rs2073813 -0.06039552152 0.2956527097 rs11564776 -0.1864266568 ... (4 Replies)
Discussion started by: luoruicd
4 Replies

6. UNIX for Dummies Questions & Answers

How to archive old files from the recently added 10 files?

Hi there, I am very new to unix and having trouble with a fairly simple statement: cd /user ls -t -c1 | sed -ne '11,$p' | mv xargs archive/ What I want the code to do is sort all files in a directory by timestamp, select all of the files after the 10th file, and then move those files... (3 Replies)
Discussion started by: DSIReady
3 Replies

7. Shell Programming and Scripting

New sequence nos to be added in new files

Hi All, Please help me in below request. Got multiple files in a dir ex: /os . from each file need to filter based upon first field (field only has 1,2,3 or 4) and then put it in different files based on the Field 1. But need to generate a sequence while inserting and the sequence number needs... (1 Reply)
Discussion started by: rdakshn
1 Replies

8. Shell Programming and Scripting

how to delete the older files other than the recently added 5 files

Number of files will get created in a folder automatically daily.. so i hav to delete the older files other than the recently added 5 files.. Could u help me through this..?? (5 Replies)
Discussion started by: shaal89
5 Replies

9. UNIX for Dummies Questions & Answers

Recursive directory listing without listing files

Does any one know how to get a recursive directory listing in long format (showing owner, group, permission etc) without listing the files contained in the directories. The following command also shows the files but I only want to see the directories. ls -lrtR * (4 Replies)
Discussion started by: psingh
4 Replies
Login or Register to Ask a Question