LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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: 216

Rep: Reputation: 208Reputation: 208Reputation: 208
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, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
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: 216

Rep: Reputation: 208Reputation: 208Reputation: 208
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, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
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: 216

Rep: Reputation: 208Reputation: 208Reputation: 208
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
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
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
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,491

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
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
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: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
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 (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
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: 4,863
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
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,727

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
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
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
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: 2,792

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


Reply



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 02:00 AM.

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
Open Source Consulting | Domain Registration