- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: sort files by size
-
- Forums
-
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
- HPE Blog, Austria, Germany & Switzerland
- Blog HPE, France
- HPE Blog, Italy
- HPE Blog, Japan
- HPE Blog, Middle East
- HPE Blog, Russia
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
-
Blogs
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Blog, Latin America
- HPE Blog, Middle East
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
-
Information
- Community
- Welcome
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Tips and Tricks
- Resources
- Announcements
- Email us
- Feedback
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Aruba Airheads Community
- Enterprise.nxt
- HPE Dev Community
- Cloud28+ Community
- Marketplace
-
Forums
-
Blogs
-
Information
-
English
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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.
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2021 Hewlett Packard Enterprise Development LP