BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
forumsguy
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
jakarman
Barite | Level 11

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

4 REPLIES 4
jakarman
Barite | Level 11

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 --<-----
ballardw
Super User

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.

Ksharp
Super User

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 .

jakarman
Barite | Level 11

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 --<-----

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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