LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX
User Name
Password
Other *NIX This forum is for the discussion of any UNIX platform that does not have its own forum. Examples would include HP-UX, IRIX, Darwin, Tru64 and OS X.

Notices


Reply
  Search this Thread
Old 03-19-2019, 01:07 AM   #1
User_123
LQ Newbie
 
Registered: Mar 2019
Posts: 1

Rep: Reputation: Disabled
Need support on urgent basis


Hi,

I want to list out only the files inside my directory /A/B/C and not the sub directories and
files inside them. What I am using is
find . -maxdepth 1 -type f -ctime +1

Unfortunately I am getting error as:
find: bad option -maxdpeth

Looks like my find is not supporting maxdepth.

Is there any other simple way to do this?
I don't prefer using ls as it causes problems when there are large number of files


I am using AIX flavor

Last edited by User_123; 03-19-2019 at 01:08 AM.
 
Old 03-19-2019, 01:11 AM   #2
freemedia2018
Member
 
Registered: Mar 2019
Distribution: various automated remasters
Posts: 100
Blog Entries: 1

Rep: Reputation: 50
Code:
find dir ! -path dir -prune -type f -name filemask
From https://unix.stackexchange.com/quest...or-find-in-aix

Last edited by freemedia2018; 03-19-2019 at 01:19 AM.
 
Old 03-19-2019, 01:13 AM   #3
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth? I would say I hope so but I'm not so sure about that... I could just be a figment of your imagination too.
Distribution: CentOS at the time of this writing, but some others over the years too...
Posts: 2,619

Rep: Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315
Quote:
Originally Posted by User_123 View Post
Hi,

I want to list out only the files inside my directory /A/B/C and not the sub directories and
files inside them. What I am using is
find . -maxdepth 1 -type f -ctime +1

Unfortunately I am getting error as:
find: bad option -maxdpeth

Looks like my find is not supporting maxdepth.

Is there any other simple way to do this?
I don't prefer using ls as it causes problems when there are large number of files


I am using AIX flavor
First, it's NOT "urgent" for anyone. Second, your own error message is telling what the problem is - you misspelt "maxdepth".
 
1 members found this post helpful.
Old 03-19-2019, 01:18 AM   #4
freemedia2018
Member
 
Registered: Mar 2019
Distribution: various automated remasters
Posts: 100
Blog Entries: 1

Rep: Reputation: 50
Quote:
Originally Posted by jsbjsb001 View Post
your own error message is telling what the problem is - you misspelt "maxdepth".
I thought maybe it was that too, until I looked it up.

Hey, you dont know if it's urgent-- maybe hes saving the world (probably not.) I dont know either, I chose to ignore that part.
 
1 members found this post helpful.
Old 03-19-2019, 01:32 AM   #5
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth? I would say I hope so but I'm not so sure about that... I could just be a figment of your imagination too.
Distribution: CentOS at the time of this writing, but some others over the years too...
Posts: 2,619

Rep: Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315Reputation: 1315
Quote:
Originally Posted by freemedia2018 View Post
I thought maybe it was that too, until I looked it up.
And what does that even mean ? The error message plainly says that the option specified doesn't exist. I suggest you re-read the OP.

Quote:
Hey, you dont know if it's urgent-- maybe hes saving the world (probably not.) I dont know either, I chose to ignore that part.
I DO know in fact it's NOT "urgent" for anyone here, my dinner is more "urgent", excuse me.
 
1 members found this post helpful.
Old 03-19-2019, 01:47 AM   #6
freemedia2018
Member
 
Registered: Mar 2019
Distribution: various automated remasters
Posts: 100
Blog Entries: 1

Rep: Reputation: 50
Quote:
Originally Posted by jsbjsb001 View Post
And what does that even mean ? The error message plainly says that the option specified doesn't exist. I suggest you re-read the OP.
I suggest you go to the link I provided, where it shows that AIX doesn't have the -maxdepth option. As I already tried to tell you, I ALSO spotted the typo, and at first I thought that was the problem like you did.

Quote:
I DO know in fact it's NOT "urgent" for anyone here, my dinner is more "urgent", excuse me.
I was on your side with that point.
 
1 members found this post helpful.
Old 03-19-2019, 03:11 AM   #7
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora, Alpine, Cirros, OpenSuse/SLES
Posts: 2,851

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by User_123 View Post
I want to list out only the files inside my directory /A/B/C and not the sub directories and
files inside them.
Poor man's solution:
Code:
ls -F /A/B/C | grep -v /
Quote:
I am using AIX flavor
That's a Linux distro I have never heard of

EDIT: I only see now that you don’t like ls.
But this command:
Code:
find . -maxdepth 1 -type f -ctime +1
lists files who were changed, not modified, at least one day ago. This includes ownership or permission changes, which don’t affect file content.

maxdepth doesn’t seem to be a POSIX option. You can use the AIX man pages to confirm.

Last edited by berndbausch; 03-19-2019 at 09:02 AM.
 
2 members found this post helpful.
Old 03-19-2019, 05:52 AM   #8
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 2,877

Rep: Reputation: Disabled
Quote:
I am using AIX flavor
That's a version of Unix, it's not a Linux distro.
 
1 members found this post helpful.
Old 03-19-2019, 08:36 AM   #9
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 2,738

Rep: Reputation: 934Reputation: 934Reputation: 934Reputation: 934Reputation: 934Reputation: 934Reputation: 934Reputation: 934
Quote:
Originally Posted by User_123 View Post
I am using AIX flavor
The man pages on the system you're running are probably the best source for questions like this...
 
Old 03-19-2019, 08:58 AM   #10
onebuck
Moderator
 
Registered: Jan 2005
Location: Summer Midwest USA, Central Illinois, Winter Central Florida
Distribution: SlackwareŽ
Posts: 13,354
Blog Entries: 31

Rep: Reputation: 2545Reputation: 2545Reputation: 2545Reputation: 2545Reputation: 2545Reputation: 2545Reputation: 2545Reputation: 2545Reputation: 2545Reputation: 2545Reputation: 2545
Member Response

Hi,

Welcome to LQ!

Quote:
Originally Posted by User_123 View Post
Hi,

<snip>

I am using AIX flavor
AIX (Advanced Interactive eXecutive) is not a flavor but a IBM UNIX.

I suggest that you look at https://www.linuxquestions.org/quest...#faq_lqwelcome so you can create better posts when presenting a query here.

You can get local information by using 'man find' or online via; http://man.he.net/?topic=find&section=all

EDIT: You can look at UNIX find examples here; https://www.complexsql.com/find-command-in-unix/ Plus this online information can be helpful; http://unix.t-a-y-l-o-r.com/index.html

Hope this helps.
Have fun & enjoy!

Last edited by onebuck; 03-21-2019 at 04:58 PM. Reason: add comment & link to information.
 
Old 03-20-2019, 11:01 AM   #11
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: CentOS, MacOS, [Open]SuSE, Raspian, Red Hat, Slackware, Solaris, Tru64
Posts: 1,293

Rep: Reputation: 100Reputation: 100
Quote:
Originally Posted by User_123 View Post
I am using AIX flavor
Did you look at the find(1) manpage on AIX? Perhaps that switch isn't available. It's been a long time (easily a couple of decades) since I worked on AIX but I still remember it being rather an odd duck amongst the various UNIX flavors. The manpages are there for a reason---use 'em.

Linux is pretty much UNIX but don't be fooled by thinking that all Linux commands will work on proprietary UNIXes. I recall scratching my head for several minutes while fielding an "urgent" support call from an admin halfway around the planet before I realized that they were trying to use a Linux command to change a setting for a Solaris user account. (In this case it actually was rather "urgent" as they were trying to lock down a user account for someone who'd been fired.)
 
Old 03-21-2019, 02:37 PM   #12
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,734

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
GNU-extensions might not work in AIX. You (or your sysadmin) could install GNU!findutils though. Or you can write a script to filter the files. E.g. utility 'dirname' could be useful.

Last edited by NevemTeve; 03-21-2019 at 02:38 PM.
 
Old 03-22-2019, 11:45 AM   #13
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 2,226
Blog Entries: 5

Rep: Reputation: 1376Reputation: 1376Reputation: 1376Reputation: 1376Reputation: 1376Reputation: 1376Reputation: 1376Reputation: 1376Reputation: 1376Reputation: 1376
Quote:
Originally Posted by freemedia2018 View Post
I suggest you go to the link I provided, where it shows that AIX doesn't have the -maxdepth option. As I already tried to tell you, I ALSO spotted the typo, and at first I thought that was the problem like you did.
I try not to wade into threads relating to an OS which I've no experience of... but find(1) in AIX must be pretty ancient, i.e. still directly descended from AT&T's original UNIX system V (proprietary) code?

I checked man pages for the major *BSD derived OS and as with Linux, they also have the -maxdepth option.

 
Old 03-22-2019, 01:53 PM   #14
ehartman
Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 469

Rep: Reputation: 197Reputation: 197
Quote:
Originally Posted by berndbausch View Post
That's a Linux distro I have never heard of
AIX is not a Linux, it's IBM's own version of System V Unix.
So a lot of the utilities (like, probably, find) will NOT be the GNU ones but the original Unix (System V) applications, which may support less options then the GNU ones.
 
Old 03-24-2019, 02:20 PM   #15
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 1,056

Rep: Reputation: 461Reputation: 461Reputation: 461Reputation: 461Reputation: 461
Always prune, but the start directory
Code:
find . \! -name . -prune -type f -ctime +1
Note that +1 (days) is 48+ hours.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
urgent urgent, need help please with bash script to pass exam... engrmilad Programming 32 11-23-2011 02:02 PM
LXer: 5 KDE3 Applications I Need on a Daily Basis LXer Syndicated Linux News 0 08-25-2008 05:11 PM
Urgent Question Regarding Urgent Questions! Need Help Now! Crashed_Again LQ Suggestions & Feedback 11 10-17-2007 08:07 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX

All times are GMT -5. The time now is 09:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration