home *** CD-ROM | disk | FTP | other *** search
- ' PowerBASIC version
- ' PBTOUCH.BAS
- $Compile EXE
- $LIB ALL OFF
- $ERROR ALL OFF
- DEFINT a-z
- %True = -1
- %False = 0
- PUBLIC FileTime&,FileDate&,TUError
- $Link "Touchu.Pbu"
- $Link "FindFile.Pbu"
-
-
- FUNCTION DOHelp
- PRINT " PBTouch (c) 1990 Barry Erick"
- PRINT
- PRINT "Syntax is:"
- PRINT " PBTOUCH filename switches"
- PRINT "The switches are:"
- PRINT " -D Use DOS Time and Date -T use the passed time:
- PRINT " When using passed time, the format is:
- PRINT "PBTOUCH filename -T=date=time"
- PRINT "where:
- PRINT " date is in MM/DD/YY format and"
- PRINT " time is in HH:MM:SS format or"
- PRINT " time is in HH:MM format"
- PRINT
- PRINT "Wildcard file names are allowed."
-
- ' If you can see this source, you
- ' may want to see the pbu file source for additional
- ' things that you may do. Like update a file and
- ' then reset the time stamp to the original.
- END 255
- END FUNCTION
-
- 'get the command line.. the only way for this to work
- IF COMMAND$ = "" THEN
- a = doHelp
- ELSEIF INSTR(COMMAND$,ANY "-/") = 0 THEN
- a = DoHelp
- ELSEIF LEFT$(COMMAND$,2)="/?" OR UCASE$(LEFT$(COMMAND$,2))="/H"_
- OR LEFT$(COMMAND$,2) ="-?" OR UCASE$(LEFT$(COMMAND$,2))="-H" THEN
- a = DoHelp
- ELSE
- OurCommand$ = COMMAND$
- 'get filename
- spcloc = INSTR(COMMAND$,ANY "-/")
- FileSpec$ = Ltrim$(Rtrim$(MID$(COMMAND$,1,spcloc-1)))
- 'parce off any drive or path information
- ' check for drivespec
- DriveSpec = INSTR(filespec$,":")
- PathSpec = INSTR(FileSpec$,"\")
- IF PathSpec > 0 THEN
- ' check if more
- PPtr = PathSpec+1
- DO
- morePath = INSTR(PPtr,FileSpec$,"\")
- IF MorePath = 0 THEN EXIT LOOP
- PPTr = MorePath + 1
- LOOP
- DrivePath$ = MID$(FileSpec$,1,PPTr-1)
- ELSE
- DrivePath$ = MID$(FileSpec$,1,DriveSpec)
- END IF
- f$ = FindFirst$(FileSpec$)
- IF f$ = ""THEN EXIT IF
- FileName$ = DrivePath$+ F$
- InFirst = %True
- DO
- IF NOT InFirst% THEN
- f$ = FindNext$
- IF f$ = "" THEN EXIT LOOP
- FileName$ = Drivepath$ + F$
- END IF
- InFirst% = %False
- WhatAction$ = MID$(OurCOMMAND$,spcloc+1,1)
- SELECT CASE UCASE$(WhatAction$)
- CASE "D"
- CALL Touch(FileName$,"DOS")
- CASE "T"
- 'get the passed time and date
- 'Check.. must have two equals
- f = INSTR(OurCOMMAND$,"=")
- s = INSTR(f+1,OurCOMMAND$,"=")
- IF f = 0 OR s = 0 THEN
- TUError = 2
- EXIT SELECT
- END IF
- da$ = MID$(Ourcommand$,f+1,(s-1)-(f))
- ti$ = MID$(OurCommand$,s+1)
- CALL TouchwithThis(FileName$,da$,Ti$)
- CASE ELSE
- TUError = 2
- EXIT SELECT
- END SELECT
- LOOP
- END IF
- END (TUError)