1752577 Members
4930 Online
108788 Solutions
New Discussion юеВ

Re: Files with no name

 
SOLVED
Go to solution
Art Wiens
Respected Contributor

Files with no name

I have yet another directory with 10's of thousands of files of small files consuming vast amounts of allocated space (because of a poor choice on cluster size). I noticed while trying to list the contents of the directory, that there are "many" files that don't have a name ie. just an extension and a version.

How can I "work" with these files. If I enter DIR [dir.subdir].TXT;* I get all .TXT files, not just the no-name ones.

My goal is to backup/delete the files by year created and put them in subdirectory from where I can ZIP them if they are old enough.

Thanks in advance,
Art
3 REPLIES 3
Steven Schweda
Honored Contributor
Solution

Re: Files with no name

"%*.TXT" (or "*%.TXT") will match only the
ones with a non-null name.

alp $ dire %*.txt

Directory ALP$DKA0:[SMS.TEST3]

A.TXT;1

Total of 1 file.

alp $ dire /excl = %*.txt *.txt

Directory ALP$DKA0:[SMS.TEST3]

.TXT;1

Total of 1 file.
John Gillings
Honored Contributor

Re: Files with no name

Art,

The issue here is the DIRECTORY command default filespec of *.*;*

If you leave the filename field blank, DIRECTORY will fill in "*". As Steven has shown, "%*" means "any non null", so the /EXCLUDE qualifier can be used to exclude those files, leaving you with the ones you're interested in.

Another method is to use a command which doesn't have a wildcard default filename. For example:

$ COPY .TXT;* NL:/LOG

or use F$SEARCH

$ loop:
$ f=F$SEARCH(".TXT;*")
$ WRITE SYS$OUTPUT f
$ IF f.NES."" THEN GOTO loop

The important thing to take away from this is that the behaviour you see is a result of the DIRECTORY command, not RMS filespecs in general (but note that BACKUP uses the same defaults as DIRECTORY...)

RENAME is like COPY, so you can just RENAME the files into a subdirectory:

$ RENAME .*;* [.NONAME]/LOG
A crucible of informative mistakes
Art Wiens
Respected Contributor

Re: Files with no name

Thanks guys!

Cheers,
Art