Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

.tccignore File for Automatic File Exclusion

Aug
2,870
153
Further to my suggestion "Add a .tccignore File for Automatic File Exclusion"

This is a work-in-progress,
not yet ready for prime-time.

That is,
its purpose is for testing only.

I'm using the DIR command for testing,
after which I will start testing with COPY.

I have created a library command;

Code:
idir {
@SETLOCAL
@ECHO OFF

rem which dir
rem dir is an alias : utils.library$idir

rem .tccignore
rem *.bak
rem *.txt

if isdir r:\temp set temp=r:\temp

set ArgC=%#
set TCCIgnoreFlag=N
do kount=1 to %ArgC
  set ArgV=%[%kount]
  iff isdir %ArgV then
    if isalias %ArgV set %ArgV=%@alias[%ArgV]
    echo Folder: %ArgV
    iff %@index[%_cwd,%ArgV] eq -1 then
      echo Do not honour .tccignore
      set TCCIgnoreFlag=Y
    endiff
    rem Now that we know where the files are from...
    leave
  endiff
enddo

rem pause

iff exist .tccignore .and. %TCCIgnoreFlag eq N then
  do theFile in @.tccignore
    set Ignore=%Ignore %theFile;
  enddo
  echo Ignoring %Ignore
  internal dir /[!%Ignore] %$
else
  internal dir %$
endiff

ENDLOCAL
}

I have created an alias;
Code:
dir=utils.library$idir

If the folder in which I run the dir command has a file called .tccignore
the files contained in the .tccignore file will be ignored by the dir command.

In the R:\ folder,
and the .tccignore file exists,
but I want to do dir u:\ from the r:\ folder,
the idir command will ignore the .tccignore file.

The idir command will resolve a directory alias to a folder.

Things to remember...

I have to use an in-process pipe instead of a normal pipe.

Code:
R:\>dir u:\ | view
TCC: Unknown command "utils.library$idir"

R:\>dir u:\ |! view

Not a deal breaker in regards to the pipe,
I can live with that.

Joe
 
Last edited:
Back
Top