DATA Step, Macro, Functions and more

Get filenames modified in current month

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 85
Accepted Solution

Get filenames modified in current month

Hi,

I have a Unix directory where I get number of files . out of them I need to get the names of files which are modified in current month I.e. today-30 days  and that should exclude the files which are currently in use.

I am absolutely running out of ideas as I have less/bill experience on unix .

Any help is really really appreciated


Accepted Solutions
Solution
‎04-25-2015 05:10 AM
Valued Guide
Posts: 3,208

Re: Get filenames modified in current month

lsof lslk are OS commands that are doing a list of files that the OS sees as open/locked. (Xcmd needed)

15 Linux lsof Command Examples (Identify Open Files)   Finding and removing locked files on a GNU/Linux system | unix-heaven.org   It is requiring to understand what is happening   

---->-- ja karman --<-----

View solution in original post


All Replies
Valued Guide
Posts: 3,208

Re: Get filenames modified in current month

1/ How are seeing that they are modified by the files date-stamp or by some checksum method.

2/ files being in use. That is more difficult one by its definition.

   technically it is about locks SAS(R) 9.3 Companion for UNIX Environments but locking is not mandatory so you can miss those

   logically it is about knowing who is using that data. In that case you should have some monitoring tool that answers that question. But as with locking you can miss that info.

   What is available and what is the requirement?  

---->-- ja karman --<-----
Super User
Posts: 10,535

Re: Get filenames modified in current month

There are a number of external file functions that will let you get the names of files in a directory and then get properties such as modified date. Look for: Dopen , Dread, Dsname, Open, Foptname, Foptnum, and Finfo functions.

Super User
Posts: 9,687

Re: Get filenames modified in current month

It is OS command thing.

I would use OS command to get these result and redirect it into another file , after that using sas code to get what I want.

or use Filename statement + PIPE .

Solution
‎04-25-2015 05:10 AM
Valued Guide
Posts: 3,208

Re: Get filenames modified in current month

lsof lslk are OS commands that are doing a list of files that the OS sees as open/locked. (Xcmd needed)

15 Linux lsof Command Examples (Identify Open Files)   Finding and removing locked files on a GNU/Linux system | unix-heaven.org   It is requiring to understand what is happening   

---->-- ja karman --<-----
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 233 views
  • 0 likes
  • 4 in conversation