- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- sort files by size
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2011 11:19 PM
тАО06-08-2011 11:19 PM
please, simple question.
How to sort files in the directory by size.
Here is an example.
Whats wrong?
=============================================
$ if p1 .eqs. "" then $ p1 = "*.*"
$ close /nolog outfile
$ open /write outfile sys$manager:x.x
$ loop:
$ file = f$search( p1 )
$ if file .eqs. "" then $ goto done
$ cdt = f$file_attributes( file, "EOF" )
$! cdt = f$cvtime( cdt, "COMPARISON" )
$ write outfile -
cdt, -
" ", -
f$parse( file, , , "NAME" ),-
f$parse( file, , , "TYPE" )
$ goto loop
$ done:
$ close outfile
$ sort sys$manager:x.x sys$manager:z.z /key = (position:1,decimal)
$ type sys$manager:z.z
$ delete sys$manager:x.x.,z.z.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-08-2011 11:54 PM
тАО06-08-2011 11:54 PM
Solution$ size=f$fao("!8UL",cdt)
and then output size instead of cdt.
The sort command then is
$ sort sys$scratch:x.x sys$scratch:z.z /key=(position:1,size:8,decimal)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2011 12:07 AM
тАО06-09-2011 12:07 AM
Re: sort files by size
$ dir/size [...]/nohead/wid=(filename=90,size=8)/out=space.txt
$ sort space.txt space.txt/key=(position:92,size:9,desc)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2011 12:29 AM
тАО06-09-2011 12:29 AM
Re: sort files by size
$ with bash shell: bash -c "ls -lS"
or
$ pipe direct/nohead/notrail/size/width=(DISPLAY=90,filename=80,size=9) 'p1' |-
sort/key=(position:82,size:10,descending) sys$pipe: sys$output | type sys$pipe:
(assuming directory+filenames are not longer than 80, or extent the width).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2011 12:38 AM
тАО06-09-2011 12:38 AM
Re: sort files by size
Use QDSB, downloadable from
http://www.quadratrix.be/qdsb.html
It's free.
Greetz.
Kris (aka Qkcl)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2011 01:14 AM
тАО06-09-2011 01:14 AM
Re: sort files by size
:) with bash, so I'm unix administrator for ten last years....
Unfortunately I have no practice with OpenVMS system administration, only for playing :(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2011 01:14 AM
тАО06-09-2011 01:14 AM
Re: sort files by size
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2011 01:19 AM
тАО06-09-2011 01:19 AM
Re: sort files by size
Whatever the OP wants to use P1 for and whatever the expected output should look like,
$ bash -c "ls -lS" 'p1'
silently ignores the 'p1'
$ bash -c "ls -lS ''p1'"
requires a Posix style path in P1
and "ls -l" prints some noise. "ls -sS -c1" would come close, but the GNV version I tried seems to have problems to do the correct sort.
>>> $ pipe direct/nohead/notrail/size/width=(DISPLAY=90,filename=80,size=9) 'p1' |-
sort/key=(position:82,size:10,descending) sys$pipe: sys$output | type sys$pipe:
The OP seems to want only names and types. You may want to add a /sel=file=(nodevice,nodir,novers)
The OP had the default sorting order ascending. Anyway, here I would just sort to sys$output and omit the trailing pipe. But I would add another key to sort the file names as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2011 04:37 AM
тАО06-09-2011 04:37 AM
Re: sort files by size
The OP seems to want only names and types. You may want to add a /sel=file=(nodevice,nodir,novers)
]
But then P1 also should be restricted to one directory only, otherwise all files in different subdirectories are listed without indication which one is in which directory!
Anyway a DIR & Sort script is not perfect,
Kris's QDSB is superior.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2011 12:43 AM
тАО06-10-2011 12:43 AM
Re: sort files by size
as DEC in RT-11 DCL had done?
Very strange.