- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: To delete a file if the sie of the file is les...
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
тАО07-26-2010 12:33 AM
тАО07-26-2010 12:33 AM
I need to delete files which get created with 0 blocks. please help me.
i need a command to delete files which are less than 1 block in VMS.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-26-2010 01:04 AM
тАО07-26-2010 01:04 AM
Re: To delete a file if the sie of the file is less than 1 blocks in OpenVms
This will generate a list of zero block files:
$direct/sel=size=max=1/col=1/nohead/notrail
You can then open up this file, read each record in and issue a $DELETE command.
HTH
Craig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-26-2010 01:08 AM
тАО07-26-2010 01:08 AM
Re: To delete a file if the sie of the file is less than 1 blocks in OpenVms
And you also need:
/size=all on the $direct command line.
Craig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-26-2010 03:58 AM
тАО07-26-2010 03:58 AM
Re: To delete a file if the sie of the file is less than 1 blocks in OpenVms
i want to delete those automatially when i run a COM.
that COM should automatically get all those which has size of 0 blocks and delete. I do not want to manually do it daily.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-26-2010 04:44 AM
тАО07-26-2010 04:44 AM
Re: To delete a file if the sie of the file is less than 1 blocks in OpenVms
HELP OPEN
HELP READ
HELP CLOSE
Craig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-26-2010 04:49 AM
тАО07-26-2010 04:49 AM
Re: To delete a file if the sie of the file is less than 1 blocks in OpenVms
For an alternate method, try F$SEARCH, F$FILE_ATTRIBUTES and DELETE.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-26-2010 05:03 AM
тАО07-26-2010 05:03 AM
Re: To delete a file if the sie of the file is less than 1 blocks in OpenVms
As suggested above, combine with an f$search and a delete command, in a loop.
DAve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-26-2010 05:04 AM
тАО07-26-2010 05:04 AM
Re: To delete a file if the sie of the file is less than 1 blocks in OpenVms
Or pipe it into a tool, like perl, which can take the list and turn it into a command.
For example:
$ pipe dir/sel=size=max=1/size=allo/nohead/notrail l*.*;* | perl -ne "chomp; unlink if /;/"
Or just let perl directly do the directory walk with a glob and do the size matching:
$ perl -e "for (
Too bad that DCL/DELETE does not take @
Too bad $ DELETE does not take more 'common qualifiers'. It takes /since and /before but not /select.
Too bad DCL pipe does not come with an Unix XARGS like option.
You may also want to check out DFU HELP SEARC/FORMAT, but it's likely overkill.
( http://digiater.nl/dfu )
hth,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-26-2010 07:01 AM
тАО07-26-2010 07:01 AM
Re: To delete a file if the sie of the file is less than 1 blocks in OpenVms
thanks for your quick response. will try tis out tomorrow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-26-2010 02:51 PM
тАО07-26-2010 02:51 PM
Re: To delete a file if the sie of the file is less than 1 blocks in OpenVms
realise that a file which is being written, open for exclusive access by another process, will be reported by F$FILE, DIRECTORY and DFU as size=0, even though it may contain large volumes of data. If you have sufficient privilege, you WILL be able to delete such a file. It will just be marked DELETE PENDING and be deleted when closed. If you're not careful you could delete real data, rather than just clean up a bunch of empty files.
You may want to check before blindly deleting such a file. You can try opening it for READ access:
$ SET NOON
$ OPEN/READ test candidate-file
$ IF $STATUS THEN CLOSE/DISPOSE=DELETE test
another option is to look at creation and modification dates (CDT and RDT). If exactly equal, the file is probably open.
Stepping back though... what is creating these files, and why do you get so many of them that you care enough to delete them?
Is there a way to detect them at the point they're created, rather than go hunting? For example:
$ out=some-file-name
$ do something which may generate output in 'out'
$
$ f=F$SEARCH(out)
$ IF f.NES.""
$ THEN
$ IF F$FILE(f,"EOF").LE.0 THEN DELETE 'f'
$ ENDIF
This way you KNOW the file is OK to be deleted.
If you must search whole disks, you may find DFU is quicker than DIRECTORY, especially on large volumes:
$ MCR DFU SEARCH/SIZE=MAX=0 device