Very useful answer, thanks !
I try it but if a folder or file has space inside its name it doesn't give me the continue after the space..
for example if i have:
/dir 1 /file.exe
/dir 2 /dir3
I will get this answer:
/dir /file.exe
/dir
/dir3
:wall: any ideas?
Also i have to use it inside c code.I should use system(); ??
ls -t *.* > temp/files.txt
ls -pt */ >temp/dir.txt
and after somehow connect the two .txt's to be in columns ....
but i don't find a ls command to appear only the directories...
ls -pt */ gives me also the contents of the directories.
Any ideas??
---------- Post updated at 08:22 AM ---------- Previous update was at 08:21 AM ----------
It appears first the files and the the directories... but in columns ???
---------- Post updated at 08:28 AM ---------- Previous update was at 08:22 AM ----------
hmmm i don't know to use these two ...
i'll try reading the manual, but i think i must use something easier that i have learned in class ....
ls -t *.* > temp/files.txt
ls -1td */ > temp/dir.txt
i have the files' name listed in column at files.txt ans the directories' name listed also in column at dir.txt
Also the lists are time-sorted
Now i need a way to connect the two .txt's contexts and appear in columns ....
Somehow with
Wow, that code was impressive...
It's exactly what i wanted !
The code that i use with .txts has a little problems with columns...it's not lined up..
But this is perfect i think ...!
I don't know maybe it's a little too "specialized" for my project but thanks it's really educational..
Only a question, if i need to run this command inside a C programm under UNIX shell i should use the system(); and put inside the parenthesis the command??
Anyway thanks!
If your file is named list_cols.ksh and is in a directory that is in the PATH, then your system() call should just be:
system( "list_cols.ksh" );
---------- Post updated at 21:34 ---------- Previous update was at 21:07 ----------
It's messy, and I'd have to think hard about approving it during a code walk through, but you could put it in a system() call directly if you don't want to maintain the additional script: