#!/usr/local/bin/perl # # AP (aka ArchivePath) # # Created 1997/07/29 W. Prescott # Modifications: # 1999/05/04 whp Added capability to handle logs directory # 1999/06/22 whp Added new directories; converted to hash table $Prefix = "/GPSdata"; $Dirs{"de"} = "descriptions"; $Dirs{"in"} = "intermediate"; $Dirs{"lo"} = "logs"; $Dirs{"ra"} = "raw"; $Dirs{"ri"} = "rinex"; $Dirs{"so"} = "solutions"; $Dirs{"tr"} = "transformed"; # Check number of arguments. # -------------------------- if ($#ARGV < 1) { print ("ap creates a pathname ", "to a specified archive directory.\n", "Examples:\n"); foreach $type (sort keys %Dirs) { print ("ap $type 19970629 prints /GPSdata/$Dirs{$type}/1997/9706/970629\n"); } print ("or combine with cd to go to the directory\n"); foreach $type (sort keys %Dirs) { print ("cd `ap $type 19970629`\n"); } exit; } else { $Type = $ARGV[0]; $yyyy = substr($ARGV[1],0,4); $yy = substr($ARGV[1],2,2); $mm = substr($ARGV[1],4,2); $dd = substr($ARGV[1],6,2); } $Path = "$Prefix/$Dirs{$Type}/$yyyy/$yy$mm/$yy$mm$dd"; print ("$Path\n"); exit;