I am a new user to linux and having trouble completing this task. I want to list a directory of files and folders including the name, human readable size, and last modified date. So far I can get two of the three but not all together. For example:
Using ls -lh gives me
This is showing me the name, date, and file size for files only, the directories are not showing the size properly
Using du -hs * gives me
The directories are now showing the correct size, the files still have the correct size , but the date/time is missing. I dont really need the permissions so that missing is ok.
How can i get all three name, date/time modified, and size to display? I would like the entries listed as they appear in the directory -files then folders- or with folders/files list in alphabetical order
Any assistance provided would be appreciated.
Thanks
Moderator's Comments:
Please use CODE tags for sample input and output as well as for sample commands. You can use ICODE tags for short in-line text in the middle of a sentence.
Last edited by Don Cragun; 12-21-2014 at 03:56 AM..
Reason: Change existing CODE tags to ICODE tags; add missing CODE tags.
I am trying to load a group of files and their last dates modified into a text file that will in turn be used with SQL*Loader to load these files into Oracle. I am using a *.ksh script. I am getting the name of the file in by using the following:
for file_ext in 'cat loaddir.ext';
do
find... (2 Replies)
Hello,
I'm on a practical training and i have to change a shell script which print out a HTML-File with all Printers (and features example: IP, Mac etc.) they have in the factory.
The Features of the Printers are on each separate file. i mean every printer have an own file with it features.
... (12 Replies)
i have a k shell script that grep less than certain modified date
-------------------------------------------------
#!/bin/ksh
for i in *
do
day=`ls -ltr | grep $i | tr -s " " | cut -d " " -f6-7 | awk 'substr($0,7,4)substr($0,1,5)substr($0,11)<"Feb 1"' `
echo $day
done... (2 Replies)
Sorry for the basic question, but I have a feeling that my developers are circumventing our change control process, and I want to be able to easily keep track of the last modified date of sub-folders of the production folder.
Basically, we have this major folder PROD, and then each application... (1 Reply)
Hello all - I've looked and have not been able to find a "find" command that will list the last modified date of files within a specific directory and its subdirectories. If anyone knows of such a command it would be very much appreciated!
If possible, I would like to sort this output and have... (5 Replies)
Hi ,
In my directory , i have many days file but i want to see all those which are of todays date.
i tried this but it gives all the files
mtime -0 |ls -ltr
I tried the below option as well.
19635 find -iname "*.LOG" -mtime
19636 ls -ltr *.LOG -mtime -1
19637 ls -ltr *.LOG... (7 Replies)
Can someone draw up a script that for every file, folder and subfolder and files that will copy the creation date over top of the modified date??
I know how to touch every file recursively, but no idea how to read a files creation date then use that to touch the modification date of that file,... (3 Replies)
I'm using a script that I need to get a file's "last modified date" in a format like 01:51:14 PM. We are running on AIX 6.1.0.0. I can't seem to find the right command parameters. Help! (4 Replies)
Hi,
Am performing a find based on filename and result can contain multiple files being found
Let's say my find command is
find /Archive -f -name 12345.pdf
and result of find command is
/Archive/Folder A/12345.pdf
/Archive/Folder B/12345.pdf
please note white space in folder names
I... (2 Replies)
Discussion started by: gigagigosu
2 Replies
LEARN ABOUT ULTRIX
ar
ar(1) General Commands Manual ar(1)Name
ar - archive and library maintainer
Syntax
ar option [ posname ] archive file ...
Description
The archiver ar maintains groups of files as a single archive file. This utility is generally used to create and update library files that
the link editor uses; however, you can use the archiver for other similar purposes. This version uses a portable ASCII-format archive that
you can use on various machines that run UNIX. If you have an archive that uses an older format, see
Options
This section describes the options and suboptions that you can use with the ar utility. Suboptions must be specified with options. Fol-
lowing is a list and description of the options:
d Deletes the specified files from the archive file.
r Replaces the specified files in the archive file. If you use the suboption u with r, the archiver only replaces those files that
have last-modified dates later than the archive files. If you use a positioning character (from the set abi) you must specify the
posname argument to tell the archiver to put the new files after (a) or before (b or i). Otherwise, the archiver puts new files at
the end of the archive.
q Appends the specified files to the end of the archive file. The archiver does not accept suboption positioning characters with the
q option. It also does not check whether the files you want to add already exist in the archive. Use the q option only to avoid
quadratic behavior when you create a large archive piece by piece.
t Prints a table of contents for the files in the archive file. If you do not specify any filenames, the archiver builds a table of
contents for all files. If you specify filenames, the archiver builds a table of contents only for those files.
p Prints the specified files from the archive.
m Moves the specified files to the end of the archive. If you specify a positioning character, you must also specify the posname (as
in option r) to tell the archiver where to move the files.
x Extracts the specified files from the archive. If you do not specify any filenames, the archiver extracts all files. When it
extracts files, the archiver does not change any file. Normally, the last-modified date for each extracted file shows the date when
someone extracted it; however, when you use o, the archiver resets the last-modified date to the date recorded in the archive.
s Makes a symbol definition (symdef file) as the first file of an archive. This file contains a hash table of ranlib structures and a
corresponding string table. The symdef file's name is based on the byte ordering of the hash table and the byte ordering of the
file's target machine. Files must be consistent in their target byte ordering before the archiver can create a symdef file. If you
change the archive contents, the symdef file becomes obsolete because the archive file's name changes. If you specify s, the
archiver creates the symdef file as its last action before finishing execution. You must specify at least one other archive option
(m, p, q, r, or t) when you use the s option. For UMIPS-V, archives include member objects based on the definition of a common
object only. For UMIPS-BSD, they define the common object, but do not include the object.
v Gives a file-by-file description as the archiver makes a new archive file from an old archive and its constituent files. When you
use this option with t, the archiver lists all information about the files in the archive. When you use this option with p, the
archiver precedes each file with a name.
c Suppresses the normal message that the archiver prints when it creates the specified archive file. Normally, the archiver creates
the specified archiver file when it needs to.
l Places temporary files in the local directory. If the l option is not used then the value of the environment symbol, TMPDIR, is
used as the directory for temporary files. If TMPDIR is not defined or if the directory it references is not writable then /tmp is
used.
The suboptions do these things:
a Specifies that the file goes after the existing file (posname). Use this suboption with the m or r options.
b Specifies that the file goes before the existing file (posname). Use this suboption with the m or r options.
i Specifies that the file goes before the existing file (posname). Use this suboption with the m or r options.
o Forces a newly created file to have the last-modified date that it had before it was extracted from the archive. Use this suboption
with the x option.
u Prevents the archiver from replacing an existing file unless the replacement is newer than the existing file. This option uses the
UNIX system last modified date for this comparison. Use this suboption with the r option.
Restrictions
If you specify the same file twice in an argument list, it can appear twice in the archive file.
The o option does not change the last-modified date of a file unless you own the extracted file or you are the superuser.
This command truncates filenames to 15 characters.
Files
/tmp/v* temporaries
See Alsolorder(1), ld(1), odump(1), ranlib(1), ranhash(3x), ar(5), arcv(8)
RISC ar(1)