Question: (Closed) Linux stat command: how to get the information of files in certain directory?
0
gravatar for carolinie0306
3.5 years ago by
carolinie03060 wrote:

Hello! During the shell programming, I had a problem I should solve, I need some help. On shell programming, 'stat' command is commonly used to get the information of files or directories.

If I use the command 'stat', the result looks like this.

[1] 17 file type : directory filr size : 4096 last modification time : 2017-05-01 20:16:28 permission: 775 absolute path : /home/s/17 relative path: ./17

Under this directory, there is a sub-directory, called a. However, if I try to get the information of 'a' as the tree form, under the previous result, only this message comes out.

stat : cannot stat 'a' : No such file or directory

Is there any nice way to solve this error? I already read several posts but I still in haze. Thanks in advance!

ADD COMMENTlink written 3.5 years ago by carolinie03060

Hello carolinie0306!

We believe that this post does not fit the main topic of this site.

not related to bioinformatics. try http://unix.stackexchange.com/

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

ADD REPLYlink written 3.5 years ago by Pierre Lindenbaum131k

Oh, I did not know about that webpage! Thanks for letting me know :)

ADD REPLYlink written 3.5 years ago by carolinie03060

U can try out with "tree" command. tree <file name="" or="" folder="" name="">

This might helps you out.

ADD REPLYlink written 3.5 years ago by mks002190

Oh, Thanks! I am sorry for late response. Because of all your help, I finally done my project successfully! Thanks again for all!

ADD REPLYlink written 3.5 years ago by carolinie03060

I'm not sure what is the use of stat command in a basic shell script. Anyway, your problem is that your a (file or folder) is NOT in the directory where you are running this stat command. That's why $stat a complains that it can not find the a

ADD REPLYlink written 3.5 years ago by Santosh Anand5.2k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1675 users visited in the last hour